I have transaction advice declared on methods of sessionManager:
That works fine, whenever the userSessionLogger picks up HttpSessionEvents, it writes to the DB within a transaction. Now if I add my own custom AOP as shown below, that uses the sessionManager as advice methods (SessionManager.invalidateSessions), the userSessionLogger no longer uses a proxied instance of SessionManagerImpl:Code:<aop:config> <aop:advisor id="sessionManagerTx" advice-ref="sessionManagerTxAdvice" pointcut="execution(* foo.system.SessionManager.*(..))" order="0"/> </aop:config> <tx:advice id="sessionManagerTxAdvice"> <tx:attributes> <tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/> </tx:attributes> </tx:advice> <bean id="userSessionLogger" class="foo.webapp.listener.UserSessionLogger"> <property name="sessionManager" ref="sessionManager"/> </bean> <bean id="sessionManager" class="foo.system.SessionManagerImpl"> <property name="sessionDao" ref="sessionDao"/> <property name="userDao" ref="userDao"/> <property name="sessionRegistry" ref="sessionRegistry"/> </bean>
The userManager bean is declared in another file. If I remove the above aop, userSessionLogger uses a proxied instance of SessionManagerImpl. What's going on? I'm using Spring 2.5.2.Code:<!-- automatic session expiry when User's roles change or if they are disabled --> <aop:config> <aop:aspect id="sessionExpiryAspect" ref="sessionManager" order="3"> <aop:after pointcut="execution(* foo.service.UserManager.disableUser(foo.model.User)) and args(user)" arg-names="user" method="invalidateSessions" /> <aop:after pointcut="execution(* foo.service.UserManager.update*Roles(foo.model.User,..)) and args(user,..)" arg-names="user" method="invalidateSessions" /> </aop:aspect> </aop:config>


Reply With Quote