Search code examples
spring-bootaopaspectjspring-aop

Pointcut for all CRUD method in CrudRepository interface


I have developed a java aspect library for logs that I import in another project. All the pointCut works well except the CRUD operation of the CrudRepository interface. here is the pointcut used:

 @Pointcut("execution(public * org.springframework.data.repository.Repository+.*(..))")

Could someone tell me if this is the right pointcut or not please? thanks in advance


Solution

  • org.springframework.data.repository.Repository is just a marker interface without a single method. Try the following instead:

    @Pointcut("execution(public * org.springframework.data.repository.CrudRepository+.*(..))")