Spring中的DispatcherServlet和ContextLoaderListener
Spring框架中的DispatcherServlet和ContextLoaderListener有什么区别?当我们使用spring框架时,我们是否需要在web.xml中配置它们? 最佳答案
根WebApplicationContext是在应用程序中共享的Spring Application Context.
可以在应用程序中拥有多个DispatcherServlet实例,每个实例都有自己的WebApplicationContext.
但是,对于一个简单的Spring MVC应用程序,甚至可以在不需要根WebApplicationContext的情况下使用. DispatcherServlet仍然有自己的WebApplicationContext,但实际上并不需要父根WebApplicationContext. 那么,哪些bean应该放在根Web应用程序上下文中,哪些bean应该放在DispatcherServlet的Web应用程序上下文中? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |