interface ValueConstants
Common value constants shared between bind annotations. |
class ControllerAdvice
Specialization of Component for classes that declare ExceptionHandler, InitBinder, or ModelAttribute methods to be shared across multiple Classes with Note: For By default the methods in an |
|
class CrossOrigin
Marks the annotated method or type as permitting cross origin requests. By default all origins and headers are permitted, credentials are not allowed, and the maximum age is set to 1800 seconds (30 minutes). The list of HTTP methods is set to the methods on the NOTE: |
|
class DeleteMapping
Annotation for mapping HTTP Specifically, |
|
class ExceptionHandler
Annotation for handling exceptions in specific handler classes and/or handler methods. Handler methods which are annotated with this annotation are allowed to have very flexible signatures. They may have parameters of the following types, in arbitrary order:
The following return types are supported for handler methods:
In Servlet environments, you can combine the |
|
class GetMapping
Annotation for mapping HTTP Specifically, |
|
class InitBinder
Annotation that identifies methods which initialize the org.springframework.web.bind.WebDataBinder which will be used for populating command and form object arguments of annotated handler methods. Such init-binder methods support all arguments that RequestMapping supports, except for command/form objects and corresponding validation result objects. Init-binder methods must not have a return value; they are usually declared as Typical arguments are org.springframework.web.bind.WebDataBinder in combination with org.springframework.web.context.request.WebRequest or java.util.Locale, allowing to register context-specific editors. |
|
class Mapping
Meta annotation that indicates a web mapping annotation. |
|
class MatrixVariable
Annotation which indicates that a method parameter should be bound to a name-value pair within a path segment. Supported for RequestMapping annotated handler methods in Servlet environments. If the method parameter type is java.util.Map and a matrix variable name is specified, then the matrix variable value is converted to a java.util.Map assuming an appropriate conversion strategy is available. If the method parameter is java.util.Map or org.springframework.util.MultiValueMap and a variable name is not specified, then the map is populated with all matrix variable names and values. |
|
class ModelAttribute
Annotation that binds a method parameter or method return value to a named model attribute, exposed to a web view. Supported for controller classes with RequestMapping methods. Can be used to expose command objects to a web view, using specific attribute names, through annotating corresponding parameters of an RequestMapping method. Can also be used to expose reference data to a web view through annotating accessor methods in a controller class with RequestMapping methods. Such accessor methods are allowed to have any arguments that RequestMapping methods support, returning the model attribute value to expose. Note however that reference data and all other model content is not available to web views when request processing results in an |
|
class PatchMapping
Annotation for mapping HTTP Specifically, |
|
class PathVariable
Annotation which indicates that a method parameter should be bound to a URI template variable. Supported for RequestMapping annotated handler methods in Servlet environments. If the method parameter is java.util.Map or org.springframework.util.MultiValueMap then the map is populated with all path variable names and values. |
|
class PostMapping
Annotation for mapping HTTP Specifically, |
|
class PutMapping
Annotation for mapping HTTP Specifically, |
|
class RequestAttribute
Annotation to bind a method parameter to a request attribute. The main motivation is to provide convenient access to request attributes from a controller method with an optional/required check and a cast to the target method parameter type. |
|
class RequestBody
Annotation indicating a method parameter should be bound to the body of the web request. The body of the request is passed through an HttpMessageConverter to resolve the method argument depending on the content type of the request. Optionally, automatic validation can be applied by annotating the argument with Supported for annotated handler methods in Servlet environments. |
|
class RequestParam
Annotation which indicates that a method parameter should be bound to a web request parameter. Supported for annotated handler methods in Servlet and Portlet environments. If the method parameter type is Map and a request parameter name is specified, then the request parameter value is converted to a Map assuming an appropriate conversion strategy is available. If the method parameter is java.util.Map or org.springframework.util.MultiValueMap and a parameter name is not specified, then the map parameter is populated with all request parameter names and values. |
|
class RequestPart
Annotation that can be used to associate the part of a "multipart/form-data" request with a method argument. Supported method argument types include MultipartFile in conjunction with Spring's MultipartResolver abstraction, Note that @RequestParam annotation can also be used to associate the part of a "multipart/form-data" request with a method argument supporting the same method argument types. The main difference is that when the method argument is not a String, @RequestParam relies on type conversion via a registered Converter or PropertyEditor while @RequestPart relies on HttpMessageConverters taking into consideration the 'Content-Type' header of the request part. @RequestParam is likely to be used with name-value form fields while @RequestPart is likely to be used with parts containing more complex content (e.g. JSON, XML). |
|
class ResponseBody
Annotation that indicates a method return value should be bound to the web response body. Supported for annotated handler methods in Servlet environments. As of version 4.0 this annotation can also be added on the type level in which case it is inherited and does not need to be added on the method level. |
|
class ResponseStatus
Marks a method or exception class with the status The status code is applied to the HTTP response when the handler method is invoked and overrides status information set by other means, like Warning: when using this annotation on an exception class, or when setting the With Note that a controller class may also be annotated with |
|
class RestController
A convenience annotation that is itself annotated with Controller and ResponseBody. Types that carry this annotation are treated as controllers where RequestMapping methods assume ResponseBody semantics by default. NOTE: |
|
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: |
|
class SessionAttribute
Annotation to bind a method parameter to a session attribute. The main motivation is to provide convenient access to existing, permanent session attributes (e.g. user authentication object) with an optional/required check and a cast to the target method parameter type. For use cases that require adding or removing session attributes consider injecting For temporary storage of model attributes in the session as part of the workflow for a controller, consider using SessionAttributes instead. |
|
class SessionAttributes
Annotation that indicates the session attributes that a specific handler uses. This will typically list the names of model attributes which should be transparently stored in the session or some conversational storage, serving as form-backing beans. Declared at the type level, applying to the model attributes that the annotated handler class operates on. NOTE: Session attributes as indicated using this annotation correspond to a specific handler's model attributes, getting transparently stored in a conversational session. Those attributes will be removed once the handler indicates completion of its conversational session. Therefore, use this facility for such conversational attributes which are supposed to be stored in the session temporarily during the course of a specific handler's conversation. For permanent session attributes, e.g. a user authentication object, use the traditional NOTE: When using controller interfaces (e.g. for AOP proxying), make sure to consistently put all your mapping annotations — such as |