title: Null pointer when creating spring boot ConfigurationProperties Map<String, Object>
body: <p>I am getting a null pointer exception when creating a spring boot ConfigurationProperties Map. The properties class is</p>
  
  <pre><code>@Component
  @ConfigurationProperties(prefix = "thing")
  public class ThingProperties {
  
   private Map&lt;String, ThingLayout&gt; layouts;
  
   public Map&lt;String, ThingLayout&gt; getLayouts() {
       return layouts == null ? new HashMap&lt;&gt;() : layouts;
   }
  
   public void setLayouts(final Map&lt;String, ThingLayout&gt; layouts) {
       this.layouts = new HashMap(layouts);
   }
  }
  </code></pre>
  
  <p>The ThingLayout is a simple pojo, with the correct properties as specified by the properties file:</p>
  
  <pre><code>things.layouts:
   3042:
    itemPageIndex: 1
    itemX: 1960
    itemY: 890
    itemWidth: 400
    itemHeight: 70
    itemPattern: dd MMMM yyyy
   2151:
    itemPageIndex: 0
    itemX: 2000
    itemY: 796
    itemWidth: 500
    itemHeight: 70
    itemPattern: dd/MM/yyyy
  </code></pre>
  
  <p>The intent is that the properties will be bound, and I will be able to do things like</p>
  
  <pre><code>thingProperties.getLayouts().get(3042).getItemX();
  </code></pre>
  
  <p>The exception that I get is</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thingProperties': Could not bind properties to ThingProperties (prefix=things, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is java.lang.IllegalArgumentException: Target object must not be null
  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:339) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:289) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  ... 47 common frames omitted
  Caused by: java.lang.IllegalArgumentException: Target object must not be null
  at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.setWrappedInstance(AbstractNestablePropertyAccessor.java:205) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:138) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.&lt;init&gt;(AbstractNestablePropertyAccessor.java:165) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.BeanWrapperImpl.&lt;init&gt;(BeanWrapperImpl.java:131) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.BeanWrapperImpl.newNestedPropertyAccessor(BeanWrapperImpl.java:223) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.BeanWrapperImpl.newNestedPropertyAccessor(BeanWrapperImpl.java:63) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.getNestedPropertyAccessor(AbstractNestablePropertyAccessor.java:853) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyAccessorForPropertyPath(AbstractNestablePropertyAccessor.java:813) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyHandler(AbstractNestablePropertyAccessor.java:724) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyType(AbstractNestablePropertyAccessor.java:485) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.resolvePropertyName(RelaxedDataBinder.java:421) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.getActualPropertyName(RelaxedDataBinder.java:385) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.initializePath(RelaxedDataBinder.java:273) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.initializePath(RelaxedDataBinder.java:308) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.initializePath(RelaxedDataBinder.java:308) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.normalizePath(RelaxedDataBinder.java:259) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.modifyProperty(RelaxedDataBinder.java:240) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.modifyProperties(RelaxedDataBinder.java:155) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.RelaxedDataBinder.doBind(RelaxedDataBinder.java:128) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.validation.DataBinder.bind(DataBinder.java:715) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
  at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:269) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:241) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:334) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
  ... 61 common frames omitted
  </code></pre>