Spring配置文件applicationContext.xml的两种拆分方式


第一种:

通过web.xml配置加载spring上下文环境,其配置方式如下: 

web.xml

contextConfigLocation /WEB-INF/applicationContext*.xml

 

(在web.xml文件里面添加以上代码。只要将以applicationContext-开头的xml文件放到WEB-INF目录之下就可以了。 一般会有applicationContext-service.xml和applicationContext-dao.xml。)


通过listener加载
org.springframework.web.context.ContextLoaderListener
或者利用severlet类加载
context org.springframework.web.context.ContextLoaderServlet 1


第二种方式:
使用Struts插件
在struts-config.xml中

你可能感兴趣的:(分布式/JEE的框架们)