Java Spring Boot aspectj编译时编织-JPA存储库
我正在使用SpringBoot应用程序,通过AspectJ编译时编织方面。我在JPA存储库中注释方法时遇到了一个问题,这些方法没有被截获 有什么解决办法吗 我使用的方面是Java Spring Boot aspectj编译时编织-JPA存储库,java,spring,spring-boot,aspectj,Java,Spring,Spring Boot,Aspectj,我正在使用SpringBoot应用程序,通过AspectJ编译时编织方面。我在JPA存储库中注释方法时遇到了一个问题,这些方法没有被截获 有什么解决办法吗 我使用的方面是 @Aspect public class ReplicaOnlyInterceptor { @Around("@annotation(xxx.xxx.ReplicaOnly) && execution(* xxx.xxx..*(..))") public Object proceed(Proc
@Aspect
public class ReplicaOnlyInterceptor {
@Around("@annotation(xxx.xxx.ReplicaOnly) && execution(* xxx.xxx..*(..))")
public Object proceed(ProceedingJoinPoint pjp) throws Throwable {
System.out.println("ReplicaOnly :" + pjp.toShortString());
Object result = proceedingJoinPoint.proceed();
return result;
}
}
存储库是
public interface PersonRepository extends JpaRepository<Config, Long> {
@ReplicaOnly
public Person findByName(String name);
}
公共接口PersonRepository扩展了JpaRepository{
@仅复制
公众人物findByName(字符串名称);
}
调用方法PersonRepository#findByName时,ReplicationLineInterceptor未被调用如果需要解决方案,应首先以允许复制的方式呈现问题。@mkl我已添加了更多详细信息,请立即检查。