我在用AuthenticationEntryPoint
处理身份验证问题。将异常原因传递给最终用户。
response.sendError(responseCode, "errorReason")
我最近将 Spring Boot 从“2.2.11.RELEASE”升级到“2.4.4”。从那时起它就不再工作了。它现在没有在客户端收到的响应中提供“errorReason”。最近在 spring-boot 中引入了我所缺少的任何更改吗?
从 Spring Boot 2.3 开始,默认情况下,该消息不再包含在错误响应中 https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#changes-to-the-default-error-pages-content:
默认情况下,错误消息和任何绑定错误不再包含在默认错误页面中。这降低了向客户泄露信息的风险。server.error.include-message
and server.error.include-binding-errors
可用于分别控制消息的包含和绑定错误。支持的值为always
, on-param
, and never
.
Setting server.error.include-message=always
将恢复 Spring Boot 2.2 的行为。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)