在理解j2ee中的上下文类型时,我有些困惑。
请解释Spring Web Applications中的Root Context / Application Context和Servlet Context。
即由ContextLoaderListener创建的根上下文
应用程序上下文/ SERVLET上下文
在Web应用程序(即特定的WAR)中由ContextLoaderListener创建的上下文包含特定于该WEB APPLICATION的单例bean 。
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/my-application-servlet.xml</param-value>
父上下文/根上下文
locatorFactorySelector或ParentContextKey创建的上下文为EAR中的所有WEB应用程序创建包含单例bean的上下文。(即EAR中的所有WARS)
<param-name>locatorFactorySelector</param-name>
<param-value>classpath:common-beans.xml</param-value>
<param-name>parentContextKey</param-name>
<param-value>commonContext</param-value>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句