When I use MySQL and hibernate for spring boot, I use below configuration in .yml file
spring: datasource: url: jdbc:mysql://localhost/userName?zeroDateTimeBehavior=convertToNull username: userName password: password driverClassName: com.mysql.jdbc.Driver jpa: show-sql: false hibernate: dialect: org.hibernate.dialect.MySQLDialect format_sql: false ddl-auto: update
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
spring: data: mongodb: user: test password: passwordvalue uri: mongodb://host:27017/db
The list of available mongodb properties are here:
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
You can find them at source for how they are loaded on github: