Spring AOP选择切点的问题

先上代码:

/**
* 管理员登录方法的切入点
*/
@Pointcut("execution(* com.arch.shiro.realm.UserRealm.doGetAuthenticationInfo(..))")
public void loginCell(){
}

/**
* 添加业务逻辑方法切入点
*/
@Pointcut("execution(* com.arch.service.*.add*(..))")
public void insertCell() {
}

/**
* 修改业务逻辑方法切入点
*/
@Pointcut("execution(* com.arch.service.*.update*(..))")
public void updateCell() {
}

/**
* 删除业务逻辑方法切入点
*/
@Pointcut("execution(* com.arch.service.*.delete*(..))")
public void deleteCell() {
}

要用Spring AOP做一个用户操作记录的功能,写了增删改查这些匹配的切入点,后来发现清空删除操作记录时,总是会留一条删除记录,仔细一看,是AOP切入的自己service的delete方法,

把AOP的delete方法改个其他名字就好了。

总结:AOP真狠啊,连自己都切。

猜你喜欢

转载自www.cnblogs.com/archwyf/p/9176556.html