Invalid bean definition with name 'connectionFactory' defined in

来源:互联网 发布:linux下sleep头文件 编辑:程序博客网 时间:2024/06/11 07:53

spring中可能出现以下错误:

java.lang.IllegalStateException: Failed to load ApplicationContext

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'connectionFactory' defined in

失败加载应用上下文,本人出现这个问题是spring.xml加载多个*.properties的时候不能使用--》

<!-- 引入jdbc配置文件 -->
      <bean id="propertyConfigurer"  
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
        <property name="location" value="classpath:jdbc.properties" />  
    </bean>


需要使用:

      <!--  引入properties配置文件     -->
 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
    <property name="locations">  
        <list>  
           <value>classpath:jdbc.properties</value>  
           <value>classpath:redis.properties</value>  
            <!-- 要是有多个配置文件,只需在这里继续添加即可   -->
        </list>  
    </property>  
</bean> 

阅读全文
0 0