我正在用Spring Boot创建一个API,所以希望禁用/error
映射。Spring Boot Disable/error mapping
我已经设置了以下道具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
是的,我做了这个确切的事情,它只是烦人!不知道是否有办法删除绑定而不这样做 – ptimson
同样,如果我删除它所有的错误现在是html而不是json ... – TheBakker