For the latest stable version, please use Spring Framework 6.2.1!

@RequestAttribute

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

  • Kotlin

@GetMapping("/")
public String handle(@RequestAttribute Client client) { (1)
	// ...
}
1 Using @RequestAttribute.
@GetMapping("/")
fun handle(@RequestAttribute client: Client): String { (1)
	// ...
}
1 Using @RequestAttribute.