-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement