Results 1 to 3 of 3

Thread: @Async versus RegexpMethodPointcutAdvisor

  1. #1
    Join Date
    Jun 2011
    Posts
    23

    Question @Async versus RegexpMethodPointcutAdvisor

    Hi,

    I'm using spring configuration that :
    - intercepts some methods using @Async annotations
    - intercepts the same methods using a RegexpMethodPointcutAdvisor using an home made interceptor registered with org.springframework.aop.framework.autoproxy.Defaul tAdvisorAutoProxyCreator
    - intercepts the same methods using the same method (RegexpMethodPointcut...) in order to manage transaction (such as documentation explains to do).

    I have many beans that matches RegexpMethodPointcutAdvisor patterns.

    Some of them are intercepted whereas others only have @Async interception.

    Is there a conflict between annotation interception and declaration interception ?

    I'm using Spring 3.1.

    Thanks for you

  2. #2
    Join Date
    Jun 2011
    Posts
    23

    Default

    I commented this configuration :

    Code:
    <!-- <task:annotation-driven executor="businessAsyncThreadExecutor"/> -->
    <!-- <task:executor id="businessAsyncThreadExecutor" pool-size="5"/> -->
    and my interceptor works again.

    Here is a piece of configuration for my other interceptor :
    Code:
     
    	<bean id="monitoringBusinessTracker" 
    	    class="net.sf.itcb.addons.monitoring.track.TrackerMethodAdvisor">
    	    <property name="pattern" value=".*ServiceImpl.*"/>
    	</bean>
    	
    	<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
    		<property name="beanName" value="monitoringBusinessTracker"/>
    	</bean>
    My advisor creates the interceptor inside afterPropertySet method.

    This advisor seems to work only when no annotation-driven interceptors are created.

    Anyone already solved this kind of problems ?

  3. #3
    Join Date
    Jun 2011
    Posts
    23

    Default

    Hello,

    I solved a part of my problem.

    Now, i proxified ehcache and task annotation-driven interception on target classe instead of interface

    Code:
    <ehcache:annotation-driven cache-manager="global-cacheManager"  proxy-target-class="true"/>
    
    <task:annotation-driven executor="businessAsyncThreadExecutor" proxy-target-class="true"/>
    <task:executor id="businessAsyncThreadExecutor" pool-size="5"/>
    Now, my interceptors, async and ehcache are working together.


    However, i noticed a problem on one class which has declarative injection and which has an @Cacheable annotated method.

    I can see that injections are done on an instance of this class but at the end, the process calls another instance built by Cglib with no injections... then, i get a NullPointerException when i call a function of missed dependency.

    Anyone has an idea on how to solve this problem ?... Kind of perfect configuration is welcome

Tags for this Thread

Posting Permissions

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