Context Based configuration works different
I'm trying to implement the following rules with Spring Schema Based AOP
I want handleExceptionThrownByAnnotatedMethod to be called on methods annotated with HandleThrown.
In case Class is annotated with HandleThrown it's methods call must be handled by handleExceptionThrownByMethodAnnotatedClass (in case they are not annotated with HandleThrown).
here is my spring context file part
<bean id="handleExceptionAspect" class="org.excha.aspect.HandleThrownAspect" />
<aop:config>
<aop:aspect ref="handleExceptionAspect">
<aop:around pointcut="@annotation(s)" method="handleExceptionThrownByAnnotatedMethod" arg-names="s" />
<aop:around pointcut="execution( !@org.excha.HandleThrown *(@org.excha.HandleThrown *).*(..) ) && @target(s)" method="handleExceptionThrownByMethodAnnotatedClas s" arg-names="s" />
</aop:aspect>
</aop:config>
both methods handleExceptionThrownByMethodAnnotatedClass and
handleExceptionThrownByAnnotatedMethod
are called in case class and method are annotated with HandleThrown
I can not understand why :(
The most strange thing is that apsect configuration based on ApectJ annotations works fine.
@Around("@annotation(s)")
public Object handleExceptionThrownByAnnotatedMethod(ProceedingJ oinPoint pjp, HandleThrown s) throws Throwable {
return ExceptionHandlingUtils.handleThrown(pjp, s);
}
@Around("execution(!@org.excha.HandleThrown *(@org.excha.HandleThrown *).*(..)) && @target(s)")
public Object handleExceptionThrownByMethodAnnotatedClass(Procee dingJoinPoint pjp, HandleThrown s) throws Throwable {
return ExceptionHandlingUtils.handleThrown(pjp, s);
}
What's wrong with my context based configuration?
Dating Friends
New Look Voucher Codes