Skip to content

loizenai/restcontrolleradvice-example-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

https://loizenai.com/restcontrolleradvice-springboot-example/

@RestControllerAdvice Example SpringBoot

@RestControllerAdvice Example SpringBoot

Tutorial: “@RestControllerAdvice Example SpringBoot – Error Handling for REST with Spring”.

In the article, I introduce about @RestControllerAdvice annotation of SpringBoot to handle RestAPI exception with a Github running sourcecode and details explanation example steps.

  • Technologies we use in the article: – Java 1.8 – Maven – Spring Boot

Annotation Type @RestControllerAdvice

@RestControllerAdvice is a new feature of Spring Framework 4.3, an annotation with combined @ControllerAdvice + @ResponseBody. So @RestControllerAdvice can help us to handle Exception with RestfulApi by a cross-cutting concern solution: @ExceptionHandler.

@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @ControllerAdvice @ResponseBody public @interface RestControllerAdvice

@RestControllerAdvice is processed if an appropriate HandlerMapping-HandlerAdapter pair is configured such as the RequestMappingHandlerMapping-RequestMappingHandlerAdapter pair which are the default in the MVC Java config and the MVC namespace.

Related post

Releases

No releases published

Packages

No packages published

Languages