Skip to content

No converter is found when binding a non-string property via config tree  #24171

@making

Description

@making

Reproducible steps with Spring Boot 2.4.0

mkdir -p /tmp/config/server/tomcat/threads 
echo 100 > /tmp/config/server/tomcat/threads/max

Configuration in application.properties

spring.config.import=configtree:/tmp/config/

Application fails to start as follows:

2020-11-17 16:47:14.546 ERROR 98427 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'server.tomcat.threads.max' to int:

    Property: server.tomcat.threads.max
    Value: 100
    Origin: path [/tmp/config/server/tomcat/threads/max] - 1:1
    Reason: No converter found capable of converting from type [org.springframework.boot.env.ConfigTreePropertySource$PropertyFileContent] to type [int]

Action:

Update your application's configuration

I tried other types like java.time.Duration and org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Show and the results were the same.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions