title: Spring Boot - inject map from properties file
body: <p>property file looks like this:</p>
  
  <pre><code>url1=path_to_binary1
  url2=path_to_binary2
  </code></pre>
  
  <p>According <a href="https://stackoverflow.com/a/30540254/2674303">this</a> I tried following approach:</p>
  
  <pre><code>@Component
  @EnableConfigurationProperties
  public class ApplicationProperties {
      private Map&lt;String, String&gt; pathMapper;
  
      //get and set
  }
  </code></pre>
  
  <p>and in another component I autowired ApplicationProperties:</p>
  
  <pre><code>@Autowired
  private ApplicationProperties properties;         
        //inside some method:
        properties.getPathMapper().get(appName);
  </code></pre>
  
  <p>produces <code>NullPointerException</code>.</p>
  
  <p>How to correct it?</p>
  
  <h2>update</h2>
  
  <p>I have correct according user7757360 advice:</p>
  
  <pre><code>@Component
  @EnableConfigurationProperties
  @ConfigurationProperties(prefix="app")
  public class ApplicationProperties {
  </code></pre>
  
  <p>and properties file:</p>
  
  <pre><code>app.url1=path_to_binary1
  app.url2=path_to_binary2
  </code></pre>
  
  <p>Still doesn't work</p>
  
  <h2>Update 2</h2>
  
  <pre><code>@Component
  @EnableConfigurationProperties
  @ConfigurationProperties(prefix="app")
  public class ApplicationProperties {
      private Map&lt;String, String&gt; app;
  </code></pre>
  
  <p>and inside <code>application.properties</code>:</p>
  
  <pre><code>app.url1=path_to_binary1
  app.url2=path_to_binary2
  </code></pre>
  
  <p>Still doesn't work</p>