Skip to content

Allow multiple hosts to be set in MongoProperties #32113

@hongjunan

Description

@hongjunan

When using ReplicaSet, access to the Mongo cluster by multiple hosts.
i'd like to write below property.

spring:
  data:
    mongodb:
      host: 0.0.0.1,0.0.0.1,0.0.0.1
      port: 27017
      username: username
      password: '{cipher}encrypted_password'
      database: testdb
      authentication-database: admin  

BUT it is not valid
because AutoConfigure does not support list of host.
it support only single instance.
https://github.com/spring-projects/spring-boot/blob/c41609d01d813a765cf04ef06ae267[…]igure/mongo/MongoPropertiesClientSettingsBuilderCustomizer.java

i know below property.

spring:
  data:
    mongodb:
      uri: "mongodb://username:[email protected],0.0.0.1,0.0.0.1:27017/testdb?authSource=admin"

it is workaround.

We need more various setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions