Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property placeholder with colon now considered as default value since 6.2 #34141

Closed
multanis63 opened this issue Dec 23, 2024 · 2 comments
Closed
Labels
status: duplicate A duplicate of another issue

Comments

@multanis63
Copy link

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));
@multanis63 multanis63 changed the title Property placeholder with colon now considered as default value Property placeholder with colon now considered as default value since 6.2 Dec 23, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 23, 2024
@snicoll
Copy link
Member

snicoll commented Dec 23, 2024

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 \.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2024
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 23, 2024
@multanis63
Copy link
Author

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants