在理解j2ee中的上下文类型方面,我有些困惑。
请解释Spring应用程序中的根上下文/应用程序上下文和Servlet上下文。
即由ContextLoaderListener创建的根上下文
发布于 2013-10-08 07:20:58
应用程序上下文/ SERVLET上下文
APPLICATION.中由ContextLoaderListener创建的上下文(即特定的WAR)包含特定于该网络ContextLoaderListener的单例bean。
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/my-application-servlet.xml</param-value>
父上下文/根上下文
由locatorFactorySelector或ParentContextKey创建的上下文为EAR中的所有 WEB应用程序创建包含单例bean的上下文。(i.e.all WARS EAR)
<param-name>locatorFactorySelector</param-name>
<param-value>classpath:common-beans.xml</param-value>
<param-name>parentContextKey</param-name>
<param-value>commonContext</param-value>
发布于 2013-10-03 12:09:00
对于web应用程序,它们都是相同的。
ServletContext是可以在web应用程序中使用的东西。applicationContext变量在jsp中可用于访问ServletContext。https://stackoverflow.com/questions/19158817
复制相似问题