1
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml /WEB-INF/classes/a.xml</param-value>
</context-param>
ApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext();
LoginAction action=(LoginAction)ctx.getBean("action");
2
String sp[]={"applicationContext.xml","a.xml"};
ApplicationContext ctx=new ClassPathXmlApplicationContext(sp);
3
ApplicationContext ctx=new ClassPathXmlApplicationContext("a*.xml");
4
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml /WEB-INF/classes/a.xml</param-value>
</context-param>
ApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext();
LoginAction action=(LoginAction)ctx.getBean("action");
2
String sp[]={"applicationContext.xml","a.xml"};
ApplicationContext ctx=new ClassPathXmlApplicationContext(sp);
3
ApplicationContext ctx=new ClassPathXmlApplicationContext("a*.xml");
4
<import resource="services.xml"/>
本文转自左正博客园博客,原文链接:http://www.cnblogs.com/soundcode/archive/2010/12/20/1911894.html,如需转载请自行联系原作者