springboot 注解文档

机翻

注解类型描述
ControllerAdvice@Component声明@ExceptionHandler,@InitBinder或 @ModelAttribute方法在多个@Controller类之间共享的for类的 特殊化。
CookieValue指示方法参数应绑定到HTTP cookie的注释。
CrossOrigin用于允许对特定处理程序类和/或处理程序方法进行跨域请求的注释。
DeleteMapping用于将HTTP DELETE请求映射到特定处理程序方法的注释。
ExceptionHandler用于在特定处理程序类和/或处理程序方法中处理异常的注释。
GetMapping用于将HTTP GET请求映射到特定处理程序方法的注释。
InitBinder注释,用于标识初始化的方法,该方法 WebDataBinder将用于填充带注释的处理程序方法的命令和表单对象参数。
Mapping指示Web映射注释的元注释。
MatrixVariable指示方法参数应绑定到路径段内的名称/值对的注释。
ModelAttribute将方法参数或方法返回值绑定到已公开的Web视图的命名模型属性的注释。
PatchMapping用于将HTTP PATCH请求映射到特定处理程序方法的注释。
PathVariable指示方法参数应绑定到URI模板变量的注释。
PostMapping用于将HTTP POST请求映射到特定处理程序方法的注释。
PutMapping用于将HTTP PUT请求映射到特定处理程序方法的注释。
RequestAttribute将方法参数绑定到请求属性的注释。
RequestBody指示方法参数的注释应绑定到Web请求的正文。
RequestHeader指示方法参数应绑定到Web请求标头的注释。
RequestMapping用于将Web请求映射到具有灵活方法签名的请求处理类中的方法的注释。
RequestParam指示方法参数应绑定到Web请求参数的注释。
RequestPart可用于将“ multipart / form-data”请求的一部分与方法参数关联的注释。
ResponseBody指示方法返回值的注释应绑定到Web响应正文。
ResponseStatus商标与状态的方法或异常类ResponseStatus.code()和 ResponseStatus.reason()应该返回。
RestController方便注释,其本身用@Controller和注释 @ResponseBody。
RestControllerAdvice方便注释,其本身用@ControllerAdvice 和注释 @ResponseBody。
SessionAttribute将session中的属性绑定到方法参数上。
SessionAttributes只作用在类上,作用是将指定的 Model 的键值对保存在 session 中。可以让其他请求共用 session 中的键值对。

官方文档

Annotation TypeDescription
ControllerAdviceSpecialization of @Component for classes that declare @ExceptionHandler, @InitBinder, or @ModelAttribute methods to be shared across multiple @Controller classes.
CookieValueAnnotation which indicates that a method parameter should be bound to an HTTP cookie.
CrossOriginAnnotation for permitting cross-origin requests on specific handler classes and/or handler methods.
DeleteMappingAnnotation for mapping HTTP DELETE requests onto specific handler methods.
ExceptionHandlerAnnotation for handling exceptions in specific handler classes and/or handler methods.
GetMappingAnnotation for mapping HTTP GET requests onto specific handler methods.
InitBinderAnnotation that identifies methods which initialize the WebDataBinder which will be used for populating command and form object arguments of annotated handler methods.
MappingMeta annotation that indicates a web mapping annotation.
MatrixVariableAnnotation which indicates that a method parameter should be bound to a name-value pair within a path segment.
ModelAttributeAnnotation that binds a method parameter or method return value to a named model attribute, exposed to a web view.
PatchMappingAnnotation for mapping HTTP PATCH requests onto specific handler methods.
PathVariableAnnotation which indicates that a method parameter should be bound to a URI template variable.
PostMappingAnnotation for mapping HTTP POST requests onto specific handler methods.
PutMappingAnnotation for mapping HTTP PUT requests onto specific handler methods.
RequestAttributeAnnotation to bind a method parameter to a request attribute.
RequestBodyAnnotation indicating a method parameter should be bound to the body of the web request.
RequestHeaderAnnotation which indicates that a method parameter should be bound to a web request header.
RequestMappingAnnotation for mapping web requests onto methods in request-handling classes with flexible method signatures.
RequestParamAnnotation which indicates that a method parameter should be bound to a web request parameter.
RequestPartAnnotation that can be used to associate the part of a “multipart/form-data” request with a method argument.
ResponseBodyAnnotation that indicates a method return value should be bound to the web response body.
ResponseStatusMarks a method or exception class with the status ResponseStatus.code() and ResponseStatus.reason() that should be returned.
RestControllerA convenience annotation that is itself annotated with @Controller and @ResponseBody.
RestControllerAdviceA convenience annotation that is itself annotated with @ControllerAdvice and @ResponseBody.
SessionAttributeAnnotation to bind a method parameter to a session attribute.
SessionAttributesAnnotation that indicates the session attributes that a specific handler uses.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值