ApplicationContext.xml 是spring 全局配置文件,用来控制spring 特性的、比如:aop,sessionFactory
xxx-servlet.xml 是spring mvc里面的,控制器、拦截uri转发view
注:
(1)如果直接使用SpringMVC是可以不添加applicationContext.xml文件的。
只需要把所有相关配置放到xxx-servlet.xml中就OK了。 (2)使用applicationContext.xml文件时是需要在web.xml中添加listener的: <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 而这个一般是采用非spring mvc架构,如使用struts之类而又想引入spring才添加的,这个是用来加载Application Context。
转载请注明原文地址: https://www.6miu.com/read-78020.html