针对Servlet生命周期的问题,你们有什么建议可以针对异常做出哪些响应...
例如,
public class Foo implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
try {
// something nasty
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void contextDestroyed(ServletContextEvent event) {
try {
// something nasty
} catch (Exception e) {
throw new RuntimeException(e);
}
}
我不确定如何处理上面的运行时异常。我的想法是,如果在这里抛出异常,它们足以完全破坏系统,因此未经处理的运行时异常可能是可以接受的。
我想知道谁会处理来自servlet上下文监听器的未经检查的异常?