This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Framework 6.2.1!

HttpEntity

HttpEntity is more or less identical to using @RequestBody but is based on a container object that exposes request headers and the body. The following example uses an HttpEntity:

  • Java

  • Kotlin

@PostMapping("/accounts")
public void handle(HttpEntity<Account> entity) {
	// ...
}
@PostMapping("/accounts")
fun handle(entity: HttpEntity<Account>) {
	// ...
}