spring-data-mongodbmongodb-javaspring-cloud-vault-config

Update MongoClient Credentials at runtime


I'm using spring-boot-starter-data-mongodb-reactive along with spring-cloud-vault-config-databases for dynamic secret rotations. Whenever the secret lease expires, I need to manually update the MongoClient credentials. Unfortunately I found no way to do so, since the credentials field in MongoClientImpl.settings cant be reassigned.

Is there any efficient way to achieve this, without swapping the hole MongoDB client configuration?


Solution

  • It's currently impossible. See https://jira.mongodb.org/browse/JAVA-3896