开发者

Spring Web: How to tell if DispatcherServlet failed to load?

I'm wondering what the best practice is for detecting whether Spring's DispatcherServlet has failed to load. I'm interested in catching all errors the servlet might have encountered while loading, but I'm most interested in errors caused by the servlet context file being incorrect (as this is the most common error).

I'm guessing I need to hook into (override) some method on DispatcherServlet, but I don't know what I should be hooking in to that would catch al开发者_JAVA技巧l possible errors.

I'm able to tell if the application context has failed via overriding the ContextLoaderListener, but I haven't been able to figure out a way to tell if the DispatcherServlet has failed.

Any help would be much appreciated! Thanks!


Override init():

@Override
void init(ServletConfig config) throws ServletException {
    try {
        super.init();
    } catch (Throwable t) {
        // Do something

        throw t;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜