[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Trapping lookup method on InitialContext
|
@Pointcut("execute(* javax.naming.Context+.lookup(
String)) &&
args(beanName)")
public void initialContextLookup(String beanName) {
}
@Around("initialContextLookup(beanName)")
public Object aroundInitialContextLookup(final ProceedingJoinPoint
thisJoinPoint, String beanName) throws Throwable
{
// code
}
1) it should be execution() and not execute() - surprised you aren't getting an error reported for that ?
2) Is the code containing the join point you want to advise passed to AspectJ? I am suspecting not as you are attempting to match on execution() of a javax packaged method. Presumably you would be ok with call() rather than execution() from your example code, so this would work:
@Pointcut("call(* javax.naming.Context+.lookup(String)) && args(beanName)") // uses call
public void initialContextLookup(String beanName) {
}
@Around("initialContextLookup(beanName)")
public Object aroundInitialContextLookup(final ProceedingJoinPoint
thisJoinPoint, String beanName) throws Throwable {
// code
}
Andy.
2009/1/23 Parmar, Dipak (IS Consultant)
<DParmar@xxxxxxxxxxxxxxxxxxx>
My advice is not getting executed.
Here is snippet of the code, where I should expect the advice should be
executed
Context ic = new InitialContext();
SOME_CLASS instance = (SOME_CLASS) ic
.lookup("JNDI_NAME");
I'm using IntelliJ and it doesn't have Aspect marker.