[org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration$MongoClientSettingsConfiguration.class]: Failed to instantiate [org.springframework.boot.autoconfigure.mongo.StandardMongoClientSettingsBuilderCustomizer]: Factory method 'standardMongoSettingsCustomizer' threw exception with message: The connection string contains invalid user information. If the username or password contains a colon (:) or an at-sign (@) then it must be urlencoded
Spring boot version: 3.1.1
Problem: Error when we have
:in our password for MongoDBThis exception is thrown by
com.mongodb.ConnectionStringline 339 of mongodb-driver-core-4.9.1.jarA solution is to url encode (java.net.URLEncoder) the username and password in:
https://github.com/spring-projects/spring-boot/blob/v3.1.1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/PropertiesMongoConnectionDetails.java#L52