title: Get list of all values that @Value could use in a Spring Boot App
body: <p>After switching to Spring Boot, I'm having an issue getting the list of properties available for @Value lookup.</p>
  
  <p>I'm using multiple properties files (classpath:application.context, and /config/applicaton.context for overrrides). That means that reading the classpath:application.context file isn't an option because of the overrides.</p>
  
  <p><strong>classpath:application.properties:</strong></p>
  
  <pre><code>foo.bar.someProp=apple
  bar.baz.someProp=peaches
  baz.foo.someProp=pumpkin
  </code></pre>
  
  <p><strong>/config/application.properties:</strong></p>
  
  <pre><code>bar.baz.someProp=cheese
  </code></pre>
  
  <p><strong>Application.java:</strong></p>
  
  <pre><code>public class Application {
  
      @Value("${foo.bar.someProp}")
      private String someProp;
  
      @Value("${bar.baz.someProp}")
      private String someProp2;
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  ...
  }
  </code></pre>
  
  <p>There's no way for me to know that the value of <strong>bar.baz.someProp</strong> is "cheese" or that <strong>baz.foo.someProp</strong> exists.</p>
  
  <p>I've seen examples using @ConfigurationProperties but I'd have to know the properties in advance, which I don't.</p>
  
  <p>Ideally I'd just like a map of the properties available to @Value lookups that I've added with the properties files.</p>
  
  <p>I know the management console can show the values of individual properties files, but I can't (not allowed to) activate it and I can't figure out how it's getting the list of properties to mimic the behavior.</p>
  
  <p>Thanks!</p>
  
  <p>Update: 2015-09-08</p>
  
  <p>Ideally there would be a method like this:</p>
  
  <pre><code>public Map&lt;String,Object) getEffectiveProperties() {
      ....          
  }
  
  Map&lt;String, Object&gt; allProperties = getEffectiveProperties();
  
  for (Map.Entry&lt;String, Integer&gt; entry : allProperties.entrySet()) {
      String key = entry.getKey().toString();
      Object value = entry.getValue();
      System.out.println("key: " + key + ", value: " + value.toString() );
  }
  </code></pre>
  
  <p>The output would be:</p>
  
  <pre><code>key: foo.bar.someProp, val: apple 
  key: bar.baz.someProp, val: cheese
  key: baz.foo.someProp, val: pumpkin
  </code></pre>