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

标签 spring tomcat transactions spring-aop

我正在尝试使用注释配置事务。当我在启用加载时间编织的环境中运行时(例如,tc 服务器或带有编织类加载器的 tomcat),我的事务拦截似乎由 aspectj 处理,但由于它没有完全配置它不起作用(我收到消息 "Skipping transactional joinpoint [<method name>] because no transaction manager has been configured" )。

我的配置状态 <tx:annotation-driven mode="proxy" transaction-manager="transactionManager" /> .无论如何,这些都应该是默认值,但我明确指定代理模式并获取 aspectj 模式。如果我切换到模式 aspectj 它可以工作,但我们的生产环境没有启用 LTW,我更愿意在所有地方使用模式代理。

知道发生了什么事吗?我在 Spring 3.0.5 上,正在使用 HibernateTransactionManager .

最佳答案

您必须在 spring xml 中定义 transactionManager bean。

<bean id="transactionManager"
  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <property name="dataSource" ref="dataSource" />
 </bean>

关于 Spring tx :annotation-driven ignores mode when load time weaving is enabled in tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4128342/

相关文章:

java - 静态资源+web-inf+Spring Boot

java - Spring @Transactional 提交失败; Deby + Eclipse链接

java - Angular POST JSON 请求返回 417 期望失败

tomcat - Nginx+Tomcat - 504 超时

tomcat不检查整个证书链

java - RestTemplate URI 模板语法

java - RMI/Tomcat 6 内存泄漏

mysql - 当机器在 mysql 事务执行之间关闭时会发生什么?

.net - 如何在 .NET 中从 Websphere MQ 获取事务?

java - Java 中对事务 API 的需求