Skip to content

Enable transaction auto-configuration when using @DataMongoTest and there is a MongoTransactionManager bean #20182

@odrotbohm

Description

@odrotbohm

Using @DataMongoTest currently does not enable auto-configuration for transactions which means that tests for transactional behavior, e.g. data not persisted on transaction rollback, will not work out of the box. Adding @ImportAutoConfiguration(TransactionAutoConfiguration.class) (or the equivalent reactive variant) makes this work.

Original StackOverflow post: https://stackoverflow.com/questions/60178310/spring-data-mongodb-transactional-isnt-working/60184283?noredirect=1#comment106470903_60184283

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions