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
In 1.5, it was possible to bind a property value that contained an unresolvable placeholder due to this change. In 2.0, that's no longer possible and the binding will fail with an exception similar to the following:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'placeholder' in value "Value with ${placeholder}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver.resolvePlaceholders(PropertySourcesPlaceholdersResolver.java:60) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.context.properties.bind.Binder.bindProperty(Binder.java:323) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:267) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
... 43 common frames omitted
If we adopt the approach that was taken in 1.x (ignore any placeholder resolution failures), a property value with a placeholder could be bound as-is as long as there's no property with that value. Ideally, we'd like to be able to support binding a value that contains something that looks like a placeholder but that should not be treated as one.
The text was updated successfully, but these errors were encountered:
Hm, after this change there is no configuration validation anymore - with 2.0.2 if certain placeholder cannot be resolved application would throw an exception on start, but after 2.0.3 it would be running just fine and example config.dbConn would have value of "${DB_CONN}" which is really confusing
@artemyarulin That was the exact intent of this change. This is a situation where it isn't possible to please all of the people all of the time. We decided that aligning the behaviour of Boot 2.0 with the behaviour of 1.5 was the best option.
In 1.5, it was possible to bind a property value that contained an unresolvable placeholder due to this change. In 2.0, that's no longer possible and the binding will fail with an exception similar to the following:
If we adopt the approach that was taken in 1.x (ignore any placeholder resolution failures), a property value with a placeholder could be bound as-is as long as there's no property with that value. Ideally, we'd like to be able to support binding a value that contains something that looks like a placeholder but that should not be treated as one.
The text was updated successfully, but these errors were encountered: