Spring WebMVC异常处理

问题描述 投票:0回答:1

我有一个全局异常处理程序,它扩展了ExceptionHandlerExceptionResolver,处理从我的@RestController抛出的异常。响应中返回的JSON有效负载包括“异常”字段。例如。

{
     "timestamp": 01010101010101
     "exception": <some exception class>
}

spring-webmvc 4.3.22.RELEASE升级到5.0.8.RELEASE后,exception场失踪。不知道这是Spring更改,还是这可能是我的代码?

rest spring-boot spring-mvc exception spring-web
1个回答
0
投票

找到了。 server.error.include-exception默认是假的。将其设置为true会重新引入此行为。

© www.soinside.com 2019 - 2024. All rights reserved.