---
title: "spring加载多个配置文件的方法"
author: "cfeers"
date: "2010-08-26T15:51:01Z"
tags: []
categories: ["企业架构"]
slug: "spring"
draft: false
lastmod: "2010-08-26T15:51:01Z"
id: 747914
url: "https://cfeers.iteye.com/blog/747914"
---

1、      在Struts2.0 中加载多个 struts.xml   ,用&lt;include file="........"&gt;&lt;/include&gt;

     例如：  
      &lt;struts&gt;  
            &lt;include file="com/test/user/action/user\_struts.xml"&gt;&lt;/include&gt;  
           &lt;include file="com/test/shop/action/shop\_struts.xml"&gt;&lt;/include&gt;  
     &lt;/struts&gt;

2、        在Spring  中加载多个  xml ,用 &lt;import resource="........"/&gt;  
          例如：  
     &lt;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"&gt;  
           &lt;import resource="classpath:com/test/user/dao/user\_dao.xml"/&gt;  
           &lt;import resource="classpath:com/test/shop/dao/shop\_dao.xml"/&gt;  
    &lt;/beans&gt;