Announcement Announcement Module
Collapse
No announcement yet.
@Async versus RegexpMethodPointcutAdvisor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • pilerou
    started a topic @Async versus RegexpMethodPointcutAdvisor

    @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

  • pilerou
    replied
    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

    Leave a comment:


  • pilerou
    replied
    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 ?

    Leave a comment:

Working...
X