首页 > 代码库 > spring配置,spring中的bean 的id不能相同

spring配置,spring中的bean 的id不能相同

lib下加入包

spring.jar

commons-logging.jar

src下添加 applicationContext.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xsi:schemaLocation="http://www.springframework.org/schema/beans
 5            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 6     <import
 7         resource="cn/itcast/spring/sh/ioc/createobject/applicationContext-createobject.xml" />
 8     <import resource="cn/itcast/spring/sh/ioc/alias/applicationContext-alias.xml" />
 9     
10     <import resource="cn/itcast/spring/sh/createobject/method/applicationContext-createobject-method.xml" />
11     
12 <!--     <import resource="cn/itcast/spring/sh/createobject/when/applicationContext-createobejct-when.xml" /> -->
13     
14 <!--     <import resource="cn/itcast/spring/sh/scope/applicationContext-scope.xml" /> -->
15     
16 <!--     <import resource="cn/itcast/spring/sh/initdestroy/applicationContext-initdestroy.xml" /> -->
17     
18 <!--     <import resource="cn/itcast/spring/sh/di/set/applicationContext-di-set.xml" /> -->
19     
20 <!--     <import resource="cn/itcast/spring/sh/di/constructor/applicationContext-di-constructor.xml" /> -->
21     
22 <!--     <import resource="cn/itcast/spring/sh/document/applicationContext-document.xml" /> -->
23 
24 <!--     <import resource="cn/itcast/spring/sh/mvc/applicationContext-mvc.xml"/> -->
25 </beans>