Spring aop???????÷??
???????????? ???????[ 2015/7/28 14:58:19 ] ??????????????????
?????????????????AOP
???????????AOP????? AspectJ ?????????????·????????
????1. ??????@Aspect????????????棬???????ж????????(@Pointcut)????????(@Before?? @AfterReturning??@After??@AfterThrowing??@Around).
????2. ????????????????
????3. ???????????xml?У????????????????????????Bean????????????????????Spring AoP?????????
??????????????? aspectJ ?? jar ???? aspectjweaver.jar aspectjrt.jar
?????????
User.java
package com.bjsxt.model;
public class User {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
/**
*?????
*/
package com.bjsxt.dao;
import com.bjsxt.model.User;
public interface UserDAO {
public void save(User user);
}
??????????
????package com.bjsxt.dao.impl;
????import org.springframework.stereotype.Component;
????import com.bjsxt.dao.UserDAO;
????import com.bjsxt.model.User;
????@Component("u")
????public class UserDAOImpl implements UserDAO {
????public void save(User user) {
????System.out.println("user save11d!");
????/*throw new RuntimeException("exception");*/ //????
????}
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11