@RequestAttribute
似@SessionAttribute中,您可以使用@RequestAttributeannotations 添加到
访问之前创建的预先存在的请求属性(例如,由 Servlet 创建的Filter或HandlerInterceptor):
-
Java
-
Kotlin
@GetMapping("/")
public String handle(@RequestAttribute Client client) { (1)
// ...
}
| 1 | 使用@RequestAttribute注解。 |
@GetMapping("/")
fun handle(@RequestAttribute client: Client): String { (1)
// ...
}
| 1 | 使用@RequestAttribute注解。 |