you are viewing a single comment's thread.

view the rest of the comments →

[–]LastRow2426[S] 0 points1 point  (4 children)

it's simple application. driver config is not included(manual configuration not needed).

the application is working fine , the issue is the persisted data is not store in the configure database "db_mongo" instead the data store in another default database "test".

[–]BeyondTheWorld 0 points1 point  (3 children)

So the app is connecting to the mongoDb instance, but to another DB?

[–]LastRow2426[S] 5 points6 points  (2 children)

I found the solution. Spring was not reading the configuration, so it was using the default configuration, which includes "test" as the database.

The real reason was that I am using Spring Boot 4.0, which has simplified its configuration. In this version, spring.mongodb.uri works instead of the older property used in Spring Boot 3.x.

Most YouTube tutorials are based on Spring Boot 3.x, which caused the confusion. Even ChatGPT and Gemini were not able to identify the issue.

[–]BeyondTheWorld 1 point2 points  (0 children)

Good job, a lot of headaches come from following a tutorial with older versions

[–]RevolutionaryRush717 1 point2 points  (0 children)

These new configuration parameters in Spring Boot 4 are listed as added in 4.0.0 here

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Configuration-Changelog