弹簧启动禁用/错误映射
2022-09-01 09:33:05
我正在使用Spring Boot创建一个API,因此希望禁用映射。/error
我在 application.properties 中设置了以下道具:
server.error.whitelabel.enabled=false
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false
但是,当我点击时,我得到:/error
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 03 Aug 2016 15:15:31 GMT
Connection: close
{"timestamp":1470237331487,"status":999,"error":"None","message":"No message available"}
所需结果
HTTP/1.1 404 Internal Server Error
Server: Apache-Coyote/1.1