You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While testing spring-boot-docker-compose (Spring Boot 3.1) I encountered an issue regarding MongoDB autoconfiguration. My Spring Boot application got an authentication error during start up. Spring Boot was using the initDB database as authentication target.
According to the official MongoDB image documentationMONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD are used to create a root user in admin database and not MONGO_INITDB_DATABASE. This would require to use admin as authentication database during autoconfiguration.