1) browser : Return to a default error page

2) Other clients , Default one json data

The principle is : Can refer to ErrorMvcAutoConfiguration; Automatic configuration of error handling

step :


private String path = "/error"; After system error error Request for processing :(web.xml Registered error page rules )

Once the system appears 4xx perhaps 5xx Mistakes like that ;ErrPageCustomizer It will take effect ( Custom error response rules ) 


How to customize error response :

1. With template engine ;error/ Status code 【 Name the error page Error status code 》html    In the template engine error Under folder 】

If an error occurs in this status code, the corresponding page will appear

2. We can use 4xx and 5xx Match all errors of this type as the filename of the error page , Precision first ( Priority to find accurate status code .html);

Information available on the page ;

    timestamp: time stamp

    status: Status code

    error: Error prompt

    exception: Exception object

    message: Exception message

     errors:JSR303 Here are all the errors in data verification


Without template engine

The template engine could not find this error page , Static resource folder 【 I don't think it's good 】


There are no error pages above , It's the default SpringBoot Default error prompt page







Continue tomorrow ~~~


©2019-2020 Toolsou All rights reserved,
One and a half years JAVA Summary of work experience Jsp+Ajax+Servlet+Mysql Add, delete, modify and query ( one ) cartoon | CPU Warfare 40 year , The real king finally appeared ! Don't annoy the panda with any cat !「 Kung Fu Panda 」20 It's the year of man 4 blood IAR Installation and use tutorial Classical algorithm - recursion ( The case of raw rabbit ) Thorough explanation from Zhongtai Random forest R Language implementation R Language cluster analysis case These songs , Programmers, don't listen !