Spring-boot handle NoHandlerException in @ControllerAdvice
问题 I want to handle NoHandlerException in Springboot app and return a custom error message. I added following to my application.properties and tried to override the error message. spring.mvc.throw-exception-if-no-handler-found=true spring.resources.add-mappings=false Error doesn't hit the @ControllerAdvice... It is handled in defaulthandlerexceptionresolver . Any ideas? 回答1: Putting @Order(Ordered.HIGHEST_PRECEDENCE) and @ControllerAdvice on the exceptions handler head, it means: