我使用spring-boot和spring-data-mongodb。 但我必须配置一个单独的连接池。可能吗?
答案 0 :(得分:3)
这里是您当前在spring boot中为mongodb配置的所有属性。
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
spring.data.mongodb.authentication-database= # Authentication database name.
spring.data.mongodb.database=test # 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=localhost # Mongo server host.
spring.data.mongodb.password= # Login password of the mongo server.
spring.data.mongodb.port=27017 # Mongo server port.
spring.data.mongodb.repositories.enabled=true # Enable Mongo repositories.
spring.data.mongodb.uri=mongodb://localhost/test # Mongo database URI. When set, host and port are ignored.
spring.data.mongodb.username= # Login user of the mongo server.
您可以通过自动装配MongoClientOptionsFactoryBean来配置连接池属性。