title: What's the best way to add a new property source in Spring?
body: <p>I'd like to add a new property source that could be used to read property values in an application. I'd like to do this using Spring. I have a piece of code like this in a @Configuration class:</p>
  
  <pre><code>@Bean
  public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {        
      PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer();
      MutablePropertySources sources = new MutablePropertySources();
      MyCustomPropertySource propertySource = new MyCustomPropertySource("my custom property source");
      sources.addFirst(propertySource);
      properties.setPropertySources(sources);
      return properties;
  }
  </code></pre>
  
  <p>This seems to work pretty well. However, what it is also doing is overriding other property values (e.g. server.port property in application.properties file used by spring boot) which I don't want to overwrite. So the basic question is what's the best way to add this propertysource but not have it override other properties. Any way to grab the existing propertysources and simply add on to it?</p>