Closed ShinojShayin closed 2 years ago
Maybe i add this to the documentation...
I followed https://blog.devgenius.io/how-to-enable-replica-set-in-embbedded-mongo-with-spring-boot-ddeaa079c1c8 and the main catch is to enable journaling (similar to @masa2146 example).
and then forked https://github.com/noway1979/springboot-embedded-mongo-replset-demo which appears to be working without copying the original AutoConfiguration class and therefore less code duplication.
I dont know if that is actually the canonical way to do it.
Maybe it would be better if this project allows to declare some EmbeddedMongoDBConfigCustomizer bean, like it can be seen for other SpringBoot Autoconfigurations.
Or expose the builder as bean and construct default MongodConfig bean by builder.build().
Last but not least, I was wondering why journaling is not enabled by default whenever a replica set is configured. But maybe I am missing some facts here...
As part of a big refactoring i was able to create a working setup as described in https://www.mongodb.com/docs/manual/tutorial/deploy-shard-cluster/
the code is here: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/blob/embed-mongo-4.x/src/test/java/de/flapdoodle/embed/mongo/transitions/MongosTest.java
but it is using this beta version: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/tree/embed-mongo-4.x
matching spring integration: https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/tree/spring-2.7.x--embed-mongo-4.x
I will close this issue:)
@michaelmosmann Maybe it would be good to provide some utility for that to prepare just a cluster for tests, which probably is mostly used? I just updated to 4.3.2
(need for spring boot 3.0) and there is no MongodConfig
for example. In general, I do not want to get into these details, especially when it is only for tests.
Hello I created mongo replica set for my tests. Here is my code