[英]No Transaction Applied when using AspectJ with iBatis, Spring
I am using iBatis 2.3.4 being called by an Axis 2 web service. 我正在使用由Axis 2 Web服务调用的iBatis 2.3.4。 I am using AspectJ weaving during the build.
在构建期间,我正在使用AspectJ编织。
I have the following Spring application context: 我有以下Spring应用程序上下文:
<bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<property name="targetDataSource">
<ref bean="dataSourceImpl" />
</property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" mode="aspectj" proxy-target-class="true"/>
I have a web service operation which has a @Transactional annotation, thus: 我有一个带有@Transactional批注的Web服务操作,因此:
@Override
@Transactional(propagation=Propagation.REQUIRED)
public void doStuff() {
System.out.println("--> isActualTransactionActive: " + TransactionSynchronizationManager.isActualTransactionActive());
.
.
.
} }
When I call the web service I see 当我调用Web服务时,我看到
--> isActualTransactionActive: false -> isActualTransactionActive:否
as the transaction is never actually applied. 因为该交易从未真正应用过。 Has anyone used AspectJ in combination with iBatis?
是否有人将AspectJ与iBatis结合使用?
Have you enabled load-time weaving? 您是否启用了加载时编织?
<context:load-time-weaver aspectj-weaving="on"/>
EDIT: 编辑:
You'll probably also need: 您可能还需要:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" />
</Context>
in your META-INF/context.xml (to avoid having to use the -javaagent command line parameter. 在您的META-INF / context.xml中(以避免使用-javaagent命令行参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.