@ControllerAdvice, Spring3.2 new annotation is provided, which is a Controller enhancer, can add some of the processing logic controller @RequestMapping method is annotated. The most commonly used is the exception handler, need to match @ ExceptionHandler use
@ExceptionHandler annotation type of treatment used to indicate an abnormality, that is, if NullPointerException is specified, the array bound exception does not come into this method .
@ControllerAdvice use
First introduced in SpringBoot in dependence thymeleaf
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Second, create a html thymeleaf in SpringBoot project templates folder
Dependence on imported red box can be used in the syntax thymeleaf!