Skip to content

spring.data.mongodb.password can't convert sring to char[] #1572

@gurinderu

Description

@gurinderu

if write password into spring.data.mongodb.password property of application.properties file we will see this exception

Caused by: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'spring.data.mongodb' on field 'password': rejected value [password]; codes [typeMismatch.spring.data.mongodb.password,typeMismatch.password,typeMismatch.[C,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.data.mongodb.password,password]; arguments []; default message [password]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'char[]' for property 'password'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type char[]]
    at org.springframework.boot.bind.PropertiesConfigurationFactory.validate(PropertiesConfigurationFactory.java:293)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:278)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:225)
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:297)
    ... 134 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions