Mongo configs on Spring Application does not reflect in tests #430
-
I have an MongoConfiguration class to assign listeners, configure database... it works running the spring application. But when i run integration tests with @DataMongoTest annotation, my listener and callbacks functions doesn't work on embedd database. `
} My test class:
` Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found that if I use annotation: @SpringBootTest, instead of @DataMongoTest, the test class is able to load all spring context (including configuration classes, listeners, ...). |
Beta Was this translation helpful? Give feedback.
I found that if I use annotation: @SpringBootTest, instead of @DataMongoTest, the test class is able to load all spring context (including configuration classes, listeners, ...).
The @DataMongoTest annotation can be used when it's not integration testing and when you don't need to load extra configurations (like the ones I did).
By the way, i'm using spring 2.7.x