读书人

spring加载多个配置文件的步骤

发布时间: 2012-09-07 10:38:15 作者: rapoo

spring加载多个配置文件的方法

1、????? 在Struts2.0 中加载多个 struts.xml?? ,用<include file="........"></include>

???? 例如:
????? <struts>
??????????? <include file="com/test/user/action/user_struts.xml"></include>
?????????? <include file="com/test/shop/action/shop_struts.xml"></include>
???? </struts>

2、??????? 在Spring? 中加载多个? xml ,用 <import resource="........"/>
????????? 例如:
???? <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.0.xsd">
?????????? <import resource="classpath:com/test/user/dao/user_dao.xml"/>
?????????? <import resource="classpath:com/test/shop/dao/shop_dao.xml"/>
??? </beans>

读书人网 >软件架构设计

热点推荐