@RequestAttribute
与 @SessionAttribute
类似,您可以使用 @RequestAttribute
注释访问先前创建的预先存在的请求属性(例如,由 WebFilter
创建的请求属性),如下面的示例所示:
Similarly to @SessionAttribute
, you can use the @RequestAttribute
annotation to
access pre-existing request attributes created earlier (for example, by a WebFilter
),
as the following example shows:
- Java
-
@GetMapping("/") public String handle(@RequestAttribute Client client) { 1 // ... }
1 | Using @RequestAttribute .
|
2 | Using @RequestAttribute . |