title: Spring Cloud Config - Could not resolve placeholder
body: <h1>Background</h1>
  
  <p>I am trying to add centralized configuration support to a medium sized spring based application. I recently made it Bootiful :D It can now run as a jar in an embedded tomcat though with the same old configuration files as before. So next I want to get rid of the filesystem property-files.
  I have the Config server setup and working, backed by a git repo containing the configuration.</p>
  
  <h1>Problem</h1>
  
  <p>During startup my application indicates that a property source is found on the config server.</p>
  
  <pre><code>2016-12-15 13:16:19,759 [admin] [ INFO] [] config.client.ConfigServicePropertySourceLocator - Fetching config from server at: http://localhost:8888
  2016-12-15 13:16:20,186 [admin] [ INFO] [] config.client.ConfigServicePropertySourceLocator - Located environment: name=myapplication, profiles=[default], label=develop, version=b065758e8ea56ff9f9e8773f263da7705b6aac29
  2016-12-15 13:16:20,188 [admin] [ INFO] [] bootstrap.config.PropertySourceBootstrapConfiguration - Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource [name='http://configserver@gitserver/config.git/application.properties']]]
  </code></pre>
  
  <p>The problem is mapping to fields annotated with <code>@Value</code> eg.</p>
  
  <pre><code>@RestController
  public class DemoController {
  
      @Value("${my.property}")
      private String myProperty;
  
      @RequestMapping("/")
      public String myproperty() {
          return myProperty;
      }
  
  }
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code>...
  Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'my.property' in string value "${my.property}"
      at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
      at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
  ...
  </code></pre>
  
  <p>Will not map the property even though a request to <code>http://localhost:8888/myapplication/default</code>responds with:</p>
  
  <pre><code>{
      "name": "myapplication",
      "profiles": [
          "default"
      ],
      "label": "develop",
      "version": "b065758e8ea56ff9f9e8773f263da7705b6aac29",
      "state": null,
      "propertySources": [
          {
              "name": "http://configserver@gitserver/config.git/application.properties",
              "source": {
                  "my.property": "Test successful"
              }
          }
      ]
  }
  </code></pre>
  
  <h1>What I have tried</h1>
  
  <h2>Clean slate</h2>
  
  <p>If i go to <a href="https://start.spring.io/" rel="nofollow noreferrer">https://start.spring.io/</a> and generate a project with the cloud config client dep and set it up to fetch the same properties as my other project everything works as intended. Which leads me to think there is some dependency in my bigger project thats is in conflict with how the properties are resolved. If i debug the project during startup i can se that the properties from my configserver are in the spring <code>Environment</code> but does not end up in the PropertyPlaceholder.</p>
  
  <h2>ConfigurationProperties</h2>
  
  <p>Mapping the properties from the configserver to a POJO annotated with <code>@ConfigurationProperties</code> works around the problem. But im not in control of all <code>@Value</code> annotated classes so i cannot use this approach for libs from other teams.</p>
  
  <h1>...so</h1>
  
  <p>Is there some way to make sure the cloud-config properties are mapped <em>before</em> <code>@Value</code> annotations are resolved?</p>