更新时间:2023-10-11 22:47:58
请注意,此处没有catch语句!而且,OutOfMemoryError
不是Exception
,因此它不会被标准的常规catch (Exception e)
捕获.
Notice that there is no catch statement here! Moreover, OutOfMemoryError
is not an Exception
, so it won't be caught by the standard general catch (Exception e)
.
使用此finally
子句不会捕获Throwable
.它必须在其他地方被捕获(已消化).
With this finally
clause the Throwable
is not caught. It must be caught (digested) somewhere else.
Spring为什么继续工作?它基于Web服务器,而不是独立的专用应用程序,为什么应该立即停止工作?并非所有异常都是至关重要的,甚至有时(...很少)可以从中恢复错误.确保正确处理所有他的"可抛物,而不是Spring的,是程序员的责任.
Why does Spring continue its work? It's based on a web server, not a standalone dedicated app, why should it stop working immediately? Not all exceptions are critical, even errors can sometimes (... rarely) recovered from. It is the programmer's duty to ensure all "his" throwables are properly handled, not Spring's.