Skip to content
Advertisement

Spring boot Mongo DB .yml configuration

When I use MySQL and hibernate for spring boot, I use below configuration in .yml file

JavaScript

If it is mongoDB instead of MySQL and hibernate how does it change?

Advertisement

Answer

The mongodb properties are all prefixed with spring.data.mongodb. For user property you would use

JavaScript

The list of available mongodb properties are here:

JavaScript

You can find them at source for how they are loaded on github:

https://github.com/spring-projects/spring-boot/blob/v2.1.5.RELEASE/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement