i have requirement in need place aspect around internal method call, internal mean
class person{ public void outermethod() { internalmethod() } // need aspect here !! public void internalmethod() { } } i aware not possible using conventional spring aop, native aspectj provide facility ? , can have pointers same
sure thing:
// match call in outermethod pointcut callinnermethod() : call(* person.internalmethod(..)); or
// match innermethod pointcut executeinnermethod() : execution(* person.internalmethod(..)); you can combine either of these before, after or around advices:
void before() : callinnermethod() /* or executeinnermethod() */ { // here } void around() : callinnermethod() /* or executeinnermethod() */{ // here proceed(); // else here } void after() returning() : callinnermethod() /* or executeinnermethod() */{ // here } note traditional aspectj-syntax, 1 use in .aj files. can use of these constructs different syntax in @aspectj .java syntax.
please consult aspectj quick reference or read aspectj in action
Comments
Post a Comment