【问题标题】:tomcat7, spring 3.0.5, errors, contextstomcat7,spring 3.0.5,错误,上下文
【发布时间】:2023-03-21 16:36:01
【问题描述】:

org.springframework.web.context.ContextLoader,如果发生异常,会:

servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);

这看起来很有用,除了它正在调用的 servlet 上下文对象没有以我能找到的任何方式连接到来自Tomcat.addWebapp 的返回值。所以当我去寻找这个属性以查看启动是否正确时,我被挫败了。

有没有办法连接这两个上下文?

【问题讨论】:

    标签: spring tomcat7


    【解决方案1】:

    Tomcat 的文档说你可以从 web-app 的 Context 获得 ServletContext

    ServletContext getServletContext()
    

    JavaDoc on Context

    【讨论】:

      猜你喜欢
      • 2017-10-13
      • 1970-01-01
      • 2016-06-06
      • 2011-06-08
      • 1970-01-01
      • 2015-02-03
      • 1970-01-01
      • 2015-07-12
      • 1970-01-01
      相关资源
      最近更新 更多