Replacing @TransactionConfiguration

I am currently using the below configuration of my test classes -

@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false) 
@Transactional

Since it’s @TransactionConfigurationout of date, what could be a substitute for this -

I tried -

@Transactional(transactionManager = "transactionManager")
@Commit

But I get the following error -

java.lang.IllegalStateException: test class [ca.aeso.dt.dao.impl.AssetAttributeDaoImplTest] is annotated using @Rollback and @TransactionConfiguration, but only one is allowed.     at org.springframework.test.context.transaction.TransactionalTestExecutionListener.isDefaultRollback (TransactionalTestExecutionListener.java{83) at org.springframework.test.context.transaction.TransactionalTestExecutionListener.isRollbackecavaaltestalecalaltactionaltestalecalaltactionaltactionaltactionaltactionaltactionaltactionaltalactionaltactionaltalactionaltactionaltactionaltalactionaltaction .transaction.TransactionalTestExecutionListener.beforeTestMethod (TransactionalTestExecutionListener.java:201) at org.springframework.test.context.TestContextManager.beforeTestMethod (TestContextManager.java:269)

+4
source share
1

, @Commit false.

, "transactionManager". , @Transactional .

@TransactionConfiguration, -, , . , @TransactionConfiguration.

,

( Spring TestContext Framework)

+4

Source: https://habr.com/ru/post/1675255/


All Articles