Hi
I am using the following on the service layer:
- annotation driven transactions
Code:<tx:annotation-driven transaction-manager="transactionManager" order="100"/>- spring modules caching using Cacheable annotation
Code:<bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" /> <bean id="cachingAttributeSourceAdvisor" class="org.springmodules.cache.interceptor.caching.CachingAttributeSourceAdvisor"> <constructor-arg ref="cachingInterceptor" /> </bean>- acegi security using Secured annotation
Code:<bean id="serviceSecurity" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="myService" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="interceptorNames"> <list> <idref bean="serviceSecurity"/> </list> </property> <property name="target"> <bean class="x.y.MyServiceImpl" parent="baseService">- Profiling Aspect as per Spring documentation with order set to 1
Code:<bean id="profiler" class="x.y.common.performance.Profiler"> <property name="order" value="1"/> </bean> <aop:config> <aop:pointcut id="serviceMethod" expression="execution(* x.y.service.impl.*ServiceImpl.*(..))"/> <aop:aspect id="profilingAspect" ref="profiler"> <aop:around method="profile" pointcut-ref="serviceMethod"/> </aop:aspect> </aop:config>
The problem is that these gets applied in somewhat random order. The transaction aspect gets applied last on the way in (good) but the caching interceptor gets applied before the security and profiling aspects (most of the time).
How do I specify an order to the interceptor(s) passed to the ProxyFactoryBeans and to the autoproxied aspects? I want the following order on the way in:
1. Profiler
2. Acegi MethodSecurityInterceptor
3. MetadataCachingInterceptor
4. TranscationInterceptor
Thanks
Peter


).
Reply With Quote