Get Spring Bean from AspectJ ProceedingJoinPoint -


i'm looking spring data repository interface or bean calling void delete(id) using aspectj, problem function there no argument or return type guess bean, there idea how calling bean or interface name aspectj proceedingjoinpoint.

this actual code:

@pointcut("execution(public * org.springframework.data.repository.repository+.save(..)) || execution(public * org.springframework.data.repository.repository+.delete(..)) && target(repository)")  public void publicnonvoidrepositorymethod(crudrepository repository) { }  @around("publicnonvoidrepositorymethod(crudrepository repository)") public object publicnonvoidrepositorymethod(proceedingjoinpoint pjp , crudrepository repository) throws throwable {  ....... } 

you can add target parameter repository has been called:

@aspect @component public class sampleaspect {     // apply repositories in package repositories     @after("execution(* repositories.*.delete(*)) && target(repository) && args(id)")     public void afterentitydelete(crudrepository repository, object id) {     ...     } } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -