Results 1 to 2 of 2

Thread: Context Based configuration works different

  1. #1

    Question 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 *).*(..) ) &amp;&amp; @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
    Last edited by Plastics; Apr 7th, 2011 at 12:07 PM.

  2. #2

    Smile

    The problem was in my IDE - everything works fine.


    Sorry for interrupting, keep doing the right job guys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •