Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded mongodb failing to run #27

Open
abcool opened this issue Feb 5, 2024 · 1 comment
Open

Embedded mongodb failing to run #27

abcool opened this issue Feb 5, 2024 · 1 comment

Comments

@abcool
Copy link

abcool commented Feb 5, 2024

https://github.com/abcool/Training/tree/master/Spring%20in%20Action/Taco%20Cloud/Chapter-4_mongodb

spring unable to connect with embedded mongo_db.

@household-four
Copy link

Autoconfig for flapdoodle embedded MongoDB support was removed after Spring Boot 2.7.0.
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#embedded-mongodb

You can use this library instead of the dependency shown in the book to get the code to run:

<dependency>
	<groupId>de.flapdoodle.embed</groupId>
	<artifactId>de.flapdoodle.embed.mongo.spring3x</artifactId>
	<version>4.18.0</version>
</dependency>

You also need to add this to application.properties to get it to know which version of mongo to use:

de.flapdoodle.mongodb.embedded.version=4.0.2

This works for my project in Java 17, Spring Boot 3.4.1

More info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants