【问题标题】:ServletContext in Spring ApplicationSpring 应用程序中的 ServletContext
【发布时间】:2013-08-08 06:45:47
【问题描述】:

我有一个简单的问题。

如果 web.xml web 应用程序描述符是这样的。

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/applicationContext.xml,
        /WEB-INF/anotherContext.xml,
        /WEB-INF/another2Context.xml
    </param-value>
</context-param>

ContextLoaderListener 在一个通用父 ServletContext 中创建三个不同的 ServletContext 或三个不同的 ServletContext 子级?

DispatcherServlet 的dispatcher-servlet.xml 配置是不是上面其他三个上下文中的另一个子?

解决方案

我一直在研究这个领域,我已经创建了一个示例应用程序,并且每个 xml 文件只创建一个 ServletContext,即由 ContextLoaderListener 创建的相同根 ServletContext 应用程序。

【问题讨论】:

    标签: spring servlets


    【解决方案1】:

    也许你可以看看这个旧答案,有一个很好的解释。

    Namespace vs contextConfigLocation Spring init parameters in web.xml

    我希望它有所帮助。

    【讨论】:

    • 我认为广泛的解释并不能解决我的问题。我想知道 中是否有多个 xml 文件由每个文件生成一个根 servletcontext 或一个根 servletcontext。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-22
    • 2013-02-03
    • 2017-06-18
    相关资源
    最近更新 更多