web.xml配置DispatcherServlet与ContextLoaderListener的问题
请教一下老师,spring与springMVC整合在web.xml的配置有的会加上ContextLoaderListener,然后再有DispatcherServlet的配置,这两者什么关系,为什么有的这样配置?这个视频中又只配置DispatcherServlet
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
下面是网上的回答解析:
http://stackoverflow.com/questions/11815339/role-purpose-of-contextloaderlistener-in-spring
http://syntx.io/difference-between-loading-context-via-dispatcherservlet-and-contextloaderlistener/
http://www.codesenior.com/en/tutorial/Spring-ContextLoaderListener-And-DispatcherServlet-Concepts