相关疑难解决方法(0)

具有特定注释的类的所有方法的@AspectJ切入点

我想监视具有指定注释的所有类的所有公共方法(比如@Monitor)(注意:注释在类级别).什么可能是一个可能的切入点?注意:我使用的是@AspectJ样式的Spring AOP.

java aop aspectj spring-aop

117
推荐指数
5
解决办法
13万
查看次数

Save 方法被拦截但 findAll 不是

问题很简单

@Around("execution(* package.*Repository.save(..))")
public Object saveInterupt(ProceedingJoinPoint joinPoint) throws Throwable {
// This gets called whenever repository save is called
}

@Around("execution(* package.*Repository.findAll(..))")
public Object findInterupt(ProceedingJoinPoint joinPoint) throws Throwable {
// This IS NOT GETTING called whenever repository findAll is called
}
Run Code Online (Sandbox Code Playgroud)

在这里打破头!

编辑:一个小突破。我打印了 target ,它返回SimpleJpaRepository而不是实际存储库。

java spring-aop spring-data-jpa spring-boot

5
推荐指数
1
解决办法
342
查看次数

标签 统计

java ×2

spring-aop ×2

aop ×1

aspectj ×1

spring-boot ×1

spring-data-jpa ×1