In My junit test case:
I use only @transactional at class or one, each test method will roll back, because each method within running a transaction. And I add it at method, then the assigned method will roll back.
I use only @TransactionConfiguration(defaultRollback = true) at class, but the transaction is not work.
I use @transaction and @TransactionConfiguration(defaultRollback = true) at class together, also it will be roll back.
My issue:
Why roll back is not work with only @TransactionConfiguration at class?
I see @transactional default bean name is transaction manager and roll back is TRUE, so i only add it at class and not @TransactionConfiguration?
@transactional must annotation, is @TransactionConfiguration only assign transaction manager in multi-transactionManager case?
在https://docs.spring.io/spring/docs/4.3.x/javadoc-api/org/springframework/test/context/transaction/TransactionConfiguration.html中 ,他们说@TransactionConfiguration已“弃用”,“自Spring开始”在框架4.2中,在类级别使用@Rollback或@Commit,在@Transactional中使用transactionManager限定符”。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.