tmtse / transaction-test Goto Github PK
View Code? Open in Web Editor NEWsomething test unit for transaction
License: MIT License
something test unit for transaction
License: MIT License
在 https://segmentfault.com/a/1190000013341344 看到了你关于spring事务传播行为的文章,很棒。结论很清晰,帮助我学习啦,star and fork
以示感谢!
TransactionPropagationExampleImpJtalTest 这个类里面的这个测试场景报错
`
/**
* 结果:张三(未插入),李四(插入),王五(插入)
* 外围方法开启事务,插入“张三”方法和外围方法一个事务,插入“李四”方法、插入“王五”方法分别在独立的新建事务中,
* 外围方法抛出异常只回滚和外围方法同一事务的方法,故插入“张三”的方法回滚。
*/
@Test
public void testTransaction_exception_required_requiresNew_requiresNew() {
transactionPropagationExample.transaction_exception_required_requiresNew_requiresNew();
}
报错如下:
org.springframework.transaction.TransactionSuspensionNotSupportedException: JtaTransactionManager needs a JTA TransactionManager for suspending a transaction: specify the 'transactionManager' or 'transactionManagerName' property
at org.springframework.transaction.jta.JtaTransactionManager.doJtaSuspend(JtaTransactionManager.java:943)
at org.springframework.transaction.jta.JtaTransactionManager.doSuspend(JtaTransactionManager.java:925)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.suspend(AbstractPlatformTransactionManager.java:579)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.handleExistingTransaction(AbstractPlatformTransactionManager.java:424)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:349)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy24.addRequiresNew(Unknown Source)
`
我的mysql版本为:<mysql-connector-java.version>8.0.28</mysql-connector-java.version>
我的源码在github: https://github.com/gitking/springboot-transaction-test
请帮忙解决一下,非常感谢,或者讲一下报错原理,麻烦了。@TmTse
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.