@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE]) @ControllerAdvice @ResponseBody class RestControllerAdvice
A convenience annotation that is itself annotated with ControllerAdvice and ResponseBody.
Types that carry this annotation are treated as controller advice where ExceptionHandler methods assume ResponseBody semantics by default.
NOTE: @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.
Author
Rossen Stoyanchev
Since
4.3
RestControllerAdvice(vararg value: String, basePackages: Array<String>, basePackageClasses: Array<KClass<*>>, assignableTypes: Array<KClass<*>>, annotations: Array<KClass<out Annotation>>)
A convenience annotation that is itself annotated with ControllerAdvice and ResponseBody. Types that carry this annotation are treated as controller advice where ExceptionHandler methods assume ResponseBody semantics by default. NOTE: |
val annotations: Array<KClass<out Annotation>>
Array of annotations. Controllers that are annotated with this/one of those annotation(s) will be assisted by the Consider creating a special annotation or use a predefined one, like RestController. |
|
val assignableTypes: Array<KClass<*>>
Array of classes. Controllers that are assignable to at least one of the given types will be assisted by the |
|
val basePackageClasses: Array<KClass<*>>
Type-safe alternative to Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute. |
|
val basePackages: Array<String>
Array of base packages. Controllers that belong to those base packages or sub-packages thereof will be included, e.g.:
Also consider using |
|
val value: Array<String>
Alias for the Allows for more concise annotation declarations e.g.: |