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

Resolve nested ${..} placeholders via PropertyResolver/Environment [SPR-9473] #14108

spring-projects-issues opened this issue Jun 5, 2012 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Jun 5, 2012

André Berenguel opened SPR-9473 and commented

The following code does not resolve the property ${database.url} correctly.

public class ApplicationConfig {

    private Environment env;


    @Bean(destroyMethod = "close")
    public DataSource dataSource() {


When the file is like


The property is being resolved as it is declared: jdbc:mysql://${}:${database.port}/${database.base}?autoReconnect=true
I expected it was resolved as jdbc:mysql://localhost:3306/mybase?autoReconnect=true

Affects: 3.1 GA

Issue Links:

  • #14203 Allow PropertyResolver implementations to ignore unresolvable ${placeholders} ("is depended on by")
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 6, 2012

Chris Beams commented

commit 2ec7834124dfa32d7b90afbb23805433a4567bf5
Author: Chris Beams <>
Commit: Chris Beams <>

    Resolve nested placeholders via PropertyResolver
    Prior to this change, PropertySourcesPropertyResolver (and therefore
    all AbstractEnvironment) implementations failed to resolve nested
    placeholders as in the following example:
    Calls to PropertySource#getProperty for keys 'p1' and 'v1' would
    successfully return their respective values, but for 'p3' the return
    value would be the unresolved placeholders. This behavior is
    inconsistent with that of PropertyPlaceholderConfigurer.
    PropertySourcesPropertyResolver #getProperty variants now resolve any
    nested placeholders recursively, throwing IllegalArgumentException for
    any unresolvable placeholders (as is the default behavior for
    PropertyPlaceholderConfigurer). See SPR-9569 for an enhancement that
    will intoduce an 'ignoreUnresolvablePlaceholders' switch to make this
    behavior configurable.
    This commit also improves error output in
    PropertyPlaceholderHelper#parseStringValue by including the original
    string in which an unresolvable placeholder was found.
    Issue: SPR-9473, SPR-9569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant