-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Regression: ResourceEditor in 3.0 does not ignore unresolvable placeholders, but it did in 2.5.6 [SPR-6321] #10987
Comments
Dave Syer commented A new feature in 3.0 is the use of ${key:defaultValue} syntax for defaulting missing values. This is probably better than the old behaviour anyway, so I'm going to leave the ResourceEditor alone and assume that the other cases are also best dealt with in this way. Added some javadocs and a unit test. |
Matt Goldspink commented Just to add we hit this issue also. After asking via support channels it seemed like this was an intentional change, but it is still a pain because it means doing something like:
In some instances of the application we would not pass in a LOCATION system property because only certain regions need to override properties. This no longer works in 3.0.RC1 and we worked around it by doing the following:
and use the new defaulting in Spring to avoid this issue. It seems a bit counterintuitive given that the settings on the PropertyPlaceholderConfigurer say "ignoreUnresolvablePlaceholders" and "ignoreResourceNotFound". I understand that they don't apply to the resources in the locations property because of the Resource objects are created before the rest of the bean definition has been applied, but it would be nice if there was a way to have the old behaviour, though given the workaround its not all that bad. |
Dave Syer commented OK, Matt, I give in. The old behaviour was better, but it does mean that the ResourceEditor has to behave this way for all applications, not just the PropertyPlaceholderConfigurer, |
Matt Goldspink commented I've got to admit the workaround is simple enough so its not a huge issue. I guess I'm still looking for the benefits of the new behaviour when its being used outside of the PropertyPlaceholderConfigurer. But since you've re-opened this now I'm happy :) Thanks Dave |
Dave Syer commented I guess the benefit of the new behaviour is a fast failure with a more meaningful exception than before. But the PropertyPlaceholderConfigurer is so ubiquitous and it has its own ignoreResourceNotFound, so on balance I think it's better not to regress. |
Dave Syer opened SPR-6321 and commented
Regression: ResourceEditor in 3.0 does not ignore unresolvable placeholders, but it did in 2.5.6. At least it would make sense to make the old behaviour an option if not the default.
The problem is possibly more ubiquitous, since all clients of org.springframework.util.SystemPropertyUtils.resolvePlaceholders(String) may be affected, but I'm not sure which of those is going to change its behaviour in 3.0.
Affects: 3.0 RC1
Issue Links:
Referenced from: commits 38f1383, 568e6a3
1 votes, 1 watchers
The text was updated successfully, but these errors were encountered: