I want to use Embedded MongoDB with Spring Boot for testing.
Here's the dependency I'm importing:
testCompile('de.flapdoodle.embed:de.flapdoodle.embed.mongo')
Whenever I start the SpringBootTest the EmbeddedMongoAutoConfiguration initializes the MongodExecutable bean and that bean starts to download a zip file (version 3.2.2) from a url. How do I configure it so that it will use the zip file located within my src/test/resources directory?
How do I configure it so that it will use the zip file located within my src/test/resources directory?
I don't know that this can be done. My solution has been to have a copy installed (for myself and my team) in the following directory:
Linux : $HOME/.embedmongo/linux/mongodb-linux-x86_64-3.2.2.tgz 
Windows : C:\Users\<username>\.embedmongo\win32\mongodb-win32-x86_64-3.x.x.zip
This will avoid the need to download the embedded mongo for the Flapdoodle OSS, which Spring uses.
Caveat: If your team needs a different version of embedded mongo you can change the version for the EmbeddedMongoProperties class by adding this property to your application.properties (or .yml) file:
spring.mongodb.embedded.version = 3.4.6 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With