设置属性值时出错;嵌套异常是org.springframework.beans.PropertyBatchUpdateException;嵌套的PropertyAccessExceptions(1)是:

时间:2014-09-29 14:10:31

标签: spring

我有以下弹簧配置文件:

<bean id="routingDataSource" class="com.dsths.cs.awd.utils.RoutingDataSource">
        <property name="targetDataSources">
            <map key-type="java.lang.String"></map>
        </property>
    </bean>

    <bean id="PowerSTEPP-DataSource" class="com.dsths.common.datasource.ConfigurationDataSourceFactoryBean">
        <property name="dataSourceName" value="${persistence.dataSourceName}" />
        <!--<property name="enableP6Spy" value="true"/>-->
   </bean>
<bean id="powerstepp_cssteppqa" class="org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter">
        <property name="targetDataSource"><ref bean="PowerSTEPP-DataSource"/></property>
        <property name="username"><value></value></property>
        <property name="password"><value></value></property>
    </bean>

     <bean id="configurationManager" class="com.dsths.common.configuration.ConfigurationManagerFactory"/>

  <!-- optional - make configuration available as a bean - This is only needed if you want to inject the configuration object into a bean -->
  <bean id="configuration" class="org.apache.commons.configuration.Configuration" factory-bean="configurationManager"
        factory-method="getEffectiveConfiguration"/>
</beans>

我正在尝试使用上面的配置文件进行单元测试。但是,不幸的是,我得到以下例外:

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

有人可以说出我的配置有什么问题吗?

0 个答案:

没有答案