http://slackspace.de/articles/log-request-body-with-spring-boot/ (filter + RequestWrapper:最优雅的写法)
https://howtodoinjava.com/servlets/httpservletrequestwrapper-example-read-request-body/ (RequestWrapper) https://coderanch.com/t/364591/java/read-request-body-filter(RequestWrapper) https://stackoverflow.com/questions/29152431/is-there-an-way-to-get-the-http-request-body-content-in-a-spring-boot-filter (ControllerAdvice的方式获取) https://gist.github.com/calo81/2071634 (filter + RequestWrapper) https://coderanch.com/t/364591/java/read-request-body-filter (filter + RequestWrapper)
Controller方法的入参不可以写多个@RequestBody。 对于 POST 请求,请求参数永远都是一个,因为一个request中只包含一个request body. 理解了这个,就会明白Spring MVC不支持多个@RequestBody。
Controller定义自定义参数对象解析 通过扩展 HandlerMethodArgumentResolver 来实现。(https://sdqali.in/blog/2016/01/29/using-custom-arguments-in-spring-mvc-controllers/) |