You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Message about nested property and it's failed constraint
APPLICATION FAILED TO START
***************************
Description:
Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'test' to com.example.conversionproblem.AppProperties failed:
Property: test.myMap[ONE].second
Value:
Reason: must not be empty
Actual Result
I got this one:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'test' to com.example.conversionproblem.AppProperties:
Property: test.my-map.one.second
Value:
Origin: class path resource [application.properties]:3:0
Reason: Cannot convert value of type 'java.lang.String' to required type 'com.example.conversionproblem.KeyType': no matching editors or conversion strategy found
Action:
Update your application's configuration
Also worth mentioning that I observe this behavior only with boot 2, boot 1.5 correctly reported issue about validation failure on second due to it's empty.
The text was updated successfully, but these errors were encountered:
zeldigas
changed the title
Misleading exception for ConfigurationProperties when key is handled by custom converter
Misleading exception for ConfigurationProperties when map key is handled by custom converter
Oct 4, 2019
With Spring Boot 2.2 the correct message is displayed:
Description:
Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'test' to com.example.conversionproblem.AppProperties failed:
Property: test.myMap[ONE].second
Value: null
Reason: must not be empty
Action:
Update your application's configuration
This is due to the changes we made for #17424. Those changes are quite involved so I'm not keen to back-port them to 2.1.x given the risk.
@zeldigas Can you try 2.2 with your real application and let me know if you still see the problem.
Uh oh!
There was an error while loading. Please reload this page.
Context
Spring boot version - 2.1.9
I've bumped into a problem with very misleading exception for
ConfigurationProperties
class.Setup (for brevity, all getters and setters are omitted)
Configuration that fails validation, e.g.
second
is emptyExpected result
Message about nested property and it's failed constraint
Actual Result
I got this one:
Extra info
I've create a sample project for you to look at the problem: https://github.com/zeldigas/spring-boot-conversion-problem
Also worth mentioning that I observe this behavior only with boot 2, boot 1.5 correctly reported issue about validation failure on
second
due to it's empty.The text was updated successfully, but these errors were encountered: