Spring Annotation driver Transaction with AspectJ problem
i am using AspectJ compile time weaving and spring 3.O. and Hibernate 3.0...AspectJ weaving is working fine for simple things like logging but this is not working correctly for Transaction
<tx:annotation-driven transaction-manager="transactionManager"
mode="aspectj" order="1" />
<bean id="tran开发者_如何学PythonsactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
Sprong-aspects jar is also present in the lib forlder but still transactional support is not working..
i am using like this
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void invokeService() throws Exception {
insertUpdatePolicy();
}
logging doesn,t specify any transactions..transactions are working fine with spring aop but not with aspectj when the class is not defined in the spring container
Please post the actual code that is failing.
Enable logging. Check the logs to see if transactions are even being managed at all. If they are, then there is probably an issue with how you configured the transactions.
i have found answer to this problem,
One thing we need to keep in mind that we need to place spring-aspects.jar to my Aspect Path instead of java class path.otherwise weaving is not done and transaction is not working.
Second thing i was missing following configuration in spring=bean config.
<bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect" factory-method="aspectOf">
<property name="transactionManager" ref="transactionManager"/>
精彩评论