ContextLoaderListener和DispatcherServlet有神马关系?

myy101 2012-12-21 08:04:01
这俩货好像都要Spring的Bean配置文件,
可以这俩货使用相同的配置文件么?
求知道:)

其实,我想问的是这俩货有神马区别?



信息: Root WebApplicationContext: initialization started
2012-12-21 19:56:08 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing Root WebApplicationContext: startup date [Fri Dec 21 19:56:08 CST 2012]; root of context hierarchy
2012-12-21 19:56:09 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2012-12-21 19:56:09 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
...全文
331 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jinpengaigo929 2015-01-26
  • 打赏
  • 举报
回复
http://www.educity.cn/wenda/356953.html
jinpengaigo929 2015-01-26
  • 打赏
  • 举报
回复
ContextLoaderListener 针对全局上下文进行加载 持久层,业务层 和试图层都加载 DispatcherServlet 针对MVC进行上下文加载的
myy101 2013-01-01
  • 打赏
  • 举报
回复
引用 3 楼 s478853630 的回复:
百度一下,会有答案
果断踢飞
s478853630 2012-12-31
  • 打赏
  • 举报
回复
百度一下,会有答案
myy101 2012-12-23
  • 打赏
  • 举报
回复
引用 1 楼 xrbsq123 的回复:
这么讲吧, ContextLoaderListener 是启动spring 容器用的,容器是用于管理Bean用的 DispatchServlet是用于拦截请求的,然后分发请求给Controller ContextLoaderListener 是去读取配置文件的
喵的DispatchServlet也是要读取配置文件的,某个文件可以同时被ContextLoaderListener和DispatchServlet读取么?求知道:)
xrbsq123 2012-12-21
  • 打赏
  • 举报
回复
这么讲吧, ContextLoaderListener 是启动spring 容器用的,容器是用于管理Bean用的 DispatchServlet是用于拦截请求的,然后分发请求给Controller ContextLoaderListener 是去读取配置文件的

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧