Use Spring Data random (embedded) Mongo port with NoSQL JUnit @Rule
问题 I'm currently trying to write an Integration test class which uses Spring Data Mongo repositories. I use an embedded Mongo instance provided by the de.flapdoodle.embed.mongo dependency. Spring Data documentation specifies that we only have to put this dependency in the project and the EmbedMongoAutoConfiguration takes care of the rest. For now, that's ok, and setting the port to 0 makes the auto configuration process to find a free port to launch the mongo instance on. This feature is