Hi,
I try to run an aspect when the method of class implementation is call if the interface of this class have an annotation...
With an example it's easier:
I have the interface with on annotation @Cacheable:
And I have also an implementation of this interfaceCode:public interface AccountService { @Cacheable public List<AccountDTO> getAccounts(); }
And also an Advice :Code:@Service public class AccountServiceImpl implements AccountService{ public List<AccountDTO> getAccounts() { ... } }
This code works fine if the annotation is on the method of the AccountServiceImpl class, but do nothing if the annotation is on AccountService.Code:@Component @Aspect public class MyAdvice { @Pointcut("@within(Cacheable) || @Annotation(Cacheable)) public static void addCachePointcut(){}; @Around("addControlPointcut()") public Object addCache(ProceedingJoinPoint point) throws Throwable{ ... }
I read Spring documentation about other Pointcut tools, but I found nothing to run this Advice.
I miss something?
Thanks for your help


Reply With Quote
