@RequestAttribute

@SessionAttribute 类似,您可以使用 @RequestAttribute 注解访问早期创建的预先存在的请求属性(例如,由 Servlet FilterHandlerInterceptor 创建的)

  • Java

  • Kotlin

@GetMapping("/")
public String handle(@RequestAttribute Client client) { (1)
	// ...
}
1 使用 @RequestAttribute 注解。
@GetMapping("/")
fun handle(@RequestAttribute client: Client): String { (1)
	// ...
}
1 使用 @RequestAttribute 注解。
© . This site is unofficial and not affiliated with VMware.