I am using testContanier for unit and integration tests.
I need to initialize mongo db with insert document. How can I initialize mongo db before spring boot is runnig ?
@BeforeAll
public static void startAndInitializeContainer(){
final MongoDBContainer mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:4.0.10"))
mongoDBContainer.start();
}
I have @PostConstruct annotation therefore I need to initialize mongodb under the @BeforeAll annotation.
Any help is appreciated.