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

时间:2022-10-15 06:10:08

lib下加入包

spring.jar

commons-logging.jar

src下添加 applicationContext.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import
resource="cn/itcast/spring/sh/ioc/createobject/applicationContext-createobject.xml" />
<import resource="cn/itcast/spring/sh/ioc/alias/applicationContext-alias.xml" /> <import resource="cn/itcast/spring/sh/createobject/method/applicationContext-createobject-method.xml" /> <!-- <import resource="cn/itcast/spring/sh/createobject/when/applicationContext-createobejct-when.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/scope/applicationContext-scope.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/initdestroy/applicationContext-initdestroy.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/di/set/applicationContext-di-set.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/di/constructor/applicationContext-di-constructor.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/document/applicationContext-document.xml" /> --> <!-- <import resource="cn/itcast/spring/sh/mvc/applicationContext-mvc.xml"/> -->
</beans>

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