Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring tx:annotation-driven ignores mode when load time weaving is enabled in tomcat

I am trying to configure transactions using annotations. When I am running in an environment with load time weaving enabled (e.g., tc server or tomcat with the weaving classloader), it seems that my transaction interception is handled by aspectj, but since it is not fully configured it doesn't work (I get a message "Skipping transactional joinpoint [<method name>] because no transaction manager has been configured").

My config states <tx:annotation-driven mode="proxy" transaction-manager="transactionManager" />. Those should all be defaults anyway, but I'm explicitly specifying proxy mode and getting aspectj mode. If I switch to mode aspectj it works, but our production environment doesn't have LTW enabled and I'd prefer to use mode proxy everywhere.

Any idea what's going on? I'm on Spring 3.0.5, and am using the HibernateTransactionManager.

like image 470
John Avatar asked Jan 28 '26 14:01

John


1 Answers

You have to define the transactionManager bean in your spring xml.

<bean id="transactionManager"
  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <property name="dataSource" ref="dataSource" />
 </bean>
like image 71
Pietro Avatar answered Jan 31 '26 04:01

Pietro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!