ITeye博客

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

cfeers · 2010-08-26 15:51 · Spring 3 · 企业架构 · Markdown

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>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。