Prior to Spring 6.2 I used to have a property like:
my.prop: ${safestore:///my/path}
With a custom property source:
public Object getProperty(String name) {
if(name.startsWith("safestore:/")) {
return ...
} else {
return null;
}
}
With Spring 6.2, 'name' doesn't contain the full placeholder 'safestore:///my/path' anymore but only 'safestore'. I guess this is now considered as a default value as it resolves to '///my/path'.
Is this expected behavior with Spring 6.2? If so, how could I achieve the same behavior as before?
Note: my property source is recorded with
environment.getPropertySources().addAfter(
StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
new KhanPropertySource(PROPERTY_SOURCE_NAME));
Comment From: snicoll
the full placeholder 'safestore:///my/path' anymore
This isn't a placeholder. The placeholder is safestore
with a fallback value of ///my/path
if no safestore
property exists in the environment.
See #34124
:
is a reserved keyword. The fact that you had to use your own property source to make this work is a sign that it isn't right. We've restored support purely because it used to be supported before but you should find a format that doesn't use the reserved keyword. Or you can escape it with \
.
Comment From: multanis63
Ha sorry I missed the duplicate.
We will wait for 6.2.2 then and adapt our code to avoid usage of ':' in the future.
Thanks @snicoll for your quick reply,