spring test에서 간단히 새로운 DB로 연결하는 방법.
@AutoConfigureMockMvc
class MyTest{
@Container
static MongoDbContainer mongoDBContainer = new MongoDBContainer("mongo:4.4.2"); //docker Image Name
@DynamicPropertySource
static void setProperties(DynamicPropertyRegistry dymDynamicPropertyRegistry) {
dymDynamicPropertyRegistry.add("spring.data.mongodb.uri", mongoDBContainer::getReplicaSetUrl);
}
}