web.xml フラグメント:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-security.xml</param-value>
</context-param>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
この答えによると:
2- DispatcherServlet コンテキストはルート コンテキストの子になります。...
私の質問は、Spring がこの決定を行う方法を理解することです (DispatcherServlet コンテキストをルートコンテキストにアタッチする)。これを指定するappContext XMLファイルには明示的なものは何もありません。また、この関連付けを明示的に行うためにXMLで指定できるものは何もありません。
DispatcherServlet がその appContext をインスタンス化するとき、それを呼び出すことをどのように認識しますかsetParent()
(SpringMVC はルート appContext がなくても問題なく動作します)、子以外の appContext が複数存在する場合、どのように選択しますか?