79629540

Date: 2025-05-19 22:09:30
Score: 2.5
Natty:
Report link

This is old, but the issue had tormented me for years and I just recently solved it so wanted to put here for others to stumble upon. The solution is to definitely use a filter as referenced in the first comment by @erichelgeson with this How can I read request body multiple times in Spring 'HandlerMethodArgumentResolver'?

It doesn't break data binding in the controller actions.

In my case though, I needed to change the body in the request before the action so I tweaked the MultipleReadHttpRequestWrapper to this https://gist.github.com/daptordarattler/81721a3ec77a05f58b7918dee5c206b9

Here is the sample project I created with a controller test case to confirm the data binding before I used it https://github.com/daptordarattler/demo-request-binding

Reasons:
  • Blacklisted phrase (0.5): How can I
  • Blacklisted phrase (0.5): I need
  • Whitelisted phrase (-1): solution is
  • Contains signature (1):
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @erichelgeson
  • Low reputation (0.5):
Posted by: daptordarattler