备忘:SpringBoot集成Mongodb
适用场景:
基础集成mongodb
版本对照表:
名称 版本
2.X
Gradle构建脚本配置:
compile("org.springframework.boot:spring-boot-starter-data-mongodb")
compile("org.springframework.boot:spring-boot-starterdata-mongodb-reactive")
增加Mongodb对应配置:
# MONGODB (MongoProperties)
spring.data.mongodb.authentication-database= # Authentication database name.
spring.data.mongodb.database= # Database name.
spring.data.mongodb.field-naming-strategy= # Fully qualified name of the FieldNamingStrategy to use.
spring.data.mongodb.grid-fs-database= # GridFS database name.
#spring.data.mongodb.host= # Mongo server host. Cannot be set with URI.
spring.data.mongodb.password= # Login password of the mongo server. Cannot be set with URI.
#spring.data.mongodb.port= # Mongo server port. Cannot be set with URI.
spring.data.mongodb.repositories.type=auto # Type of Mongo repositories to enable.
spring.data.mongodb.uri=mongodb://localhost/test # Mongo database URI. Cannot be set with host, port and
credentials.
spring.data.mongodb.username= # Login user of the mongo server. Cannot be set with URI.
以上是 备忘:SpringBoot集成Mongodb 的全部内容, 来源链接: utcz.com/z/510548.html