title: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
body: <p>I have following spring configuration file:</p>
  
  <pre><code>&lt;bean id="routingDataSource" class="com.dsths.cs.awd.utils.RoutingDataSource"&gt;
          &lt;property name="targetDataSources"&gt;
              &lt;map key-type="java.lang.String"&gt;&lt;/map&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="PowerSTEPP-DataSource" class="com.dsths.common.datasource.ConfigurationDataSourceFactoryBean"&gt;
          &lt;property name="dataSourceName" value="${persistence.dataSourceName}" /&gt;
          &lt;!--&lt;property name="enableP6Spy" value="true"/&gt;--&gt;
     &lt;/bean&gt;
  &lt;bean id="powerstepp_cssteppqa" class="org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter"&gt;
          &lt;property name="targetDataSource"&gt;&lt;ref bean="PowerSTEPP-DataSource"/&gt;&lt;/property&gt;
          &lt;property name="username"&gt;&lt;value&gt;&lt;/value&gt;&lt;/property&gt;
          &lt;property name="password"&gt;&lt;value&gt;&lt;/value&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
       &lt;bean id="configurationManager" class="com.dsths.common.configuration.ConfigurationManagerFactory"/&gt;
  
    &lt;!-- optional - make configuration available as a bean - This is only needed if you want to inject the configuration object into a bean --&gt;
    &lt;bean id="configuration" class="org.apache.commons.configuration.Configuration" factory-bean="configurationManager"
          factory-method="getEffectiveConfiguration"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I am trying to use the above config file for a unit test. But, unfortunately, I am getting the following  exception:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'powerstepp_cssteppqa' defined in class path resource [CustomerServiceRD/test-DataSourceConfiguration.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'targetDataSource' threw exception; nested exception is java.lang.IllegalArgumentException: 'targetDataSource' must not be null
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
      ... 24 more
  Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'targetDataSource' threw exception; nested exception is java.lang.IllegalArgumentException: 'targetDataSource' must not be null
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
      at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
      ... 38 more
  </code></pre>
  
  <p>Can anybody tell what's wrong with my configuration?</p>