title: @ConfigurationProperties object returned null in spring boot application
body: <p>I have a config object which is mapped to the config file as below: </p>
  
  <pre><code>@Data
  @Component
  @ConfigurationProperties("app.cors")
  public class DomainProperties {
      private Map&lt;String, String&gt; domainMap;
  }
  </code></pre>
  
  <p>and my <em>application.properties</em> config file looks like: </p>
  
  <pre><code>app.cors.domainMap.local=localhost:8080
  app.cors.domainMap.onlive=test.com
  </code></pre>
  
  <p>I am trying to read the values in the <em>domainMap</em> from the above properties file, to set them as Access-Control-Allow-Origin headers for the response of my application. What I did so far is: </p>
  
  <pre><code>public class HeaderInterceptor extends HandlerInterceptorAdapter {
  
      @Autowired
      private DomainProperties domainProperties;
      @Override
      public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
              throws Exception {
          List&lt;String&gt; domainList= domainProperties.getDomainMap().values().stream().collect(Collectors.toList());
          domainList.stream().forEach(domain -&gt; response.addHeader("Access-Control-Allow-Origin", domain));
          return super.preHandle(request, response, handler);
      }
  </code></pre>
  
  <p>but the problem is I received back a <strong>null</strong> <em>domainProperties</em> object, therefore a NullPointerException is thrown here.</p>
  
  <p>Can anyone explain me why did I get a <strong>null</strong> <em>domainProperties</em> object here? and how to resolve this problem. Thank you in advanced!</p>