Using Spring Boot 1.5.2, I have something like this in my application.yml file, in the root of the classpath of my Spring Boot jar:

mySettings:
  base-url: http://foo.com
  index-url: ${mySettings.base-url}/index.html

I have these settings bound to String properties in a MySettings POJO using @ConfigurationProperties, with the config class registered via @EnableConfigurationProperties(MyProperties.class).

According to the docs on externalized configuration, I should be able to override the base-url value e.g. via an environment variable such as MY_SETTINGS_BASE_URL=http://bar.com.

When I do this, the 'baseUrl' property in the MySettings POJO does get the value http://bar.com, but the 'indexUrl' property in the POJO still has the value 'http://foo.com/index.html'. This doesn't seem like the right behaviour.

Comment From: wilkinsona

The behaviour you're seeing is because relaxed binding isn't used when the ${mySettings.base-url} placeholder is resolved. This means that the entry in your application.yml file matches the placeholder but the MY_SETTINGS_BASE_URL environment variable does not.

For the record, 1.4 behaves in the same way. We might be able to do something about this in 2.0 as relaxed binding is being significantly overhauled. In the mean time, you can avoid the problem by combining the properties programatically rather than try to do it in your YAML file.

Comment From: wilkinsona

Duplicates #2496