Annotation Interface RequestAttribute
@Documented
@RequestParam
@Target({PARAMETER,FIELD})
@Retention(RUNTIME)
public @interface 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.
- 从以下版本开始:
- 2019-02-16 11:34
- 作者:
- Rossen Stoyanchev, TODAY
- 另请参阅:
-
可选元素概要
可选元素
-
元素详细资料
-
value
Alias forname().- 默认值:
- ""
-
name
The name of the request attribute to bind to.The default name is inferred from the method parameter name.
- 默认值:
- ""
-
required
boolean requiredWhether the request attribute is required.Defaults to
true, leading to an exception being thrown if the attribute is missing. Switch this tofalseif you prefer anullor Java 8java.util.Optionalif the attribute doesn't exist.- 默认值:
- true
-