Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've acomplished question's goal. <code>@Ralph's</code> answer was very <strong>very</strong> helpfull, but to be precise I'll write what was needed more.</p> <p>I've created <code><a href="http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/web/method/support/HandlerMethodArgumentResolver.html" rel="nofollow noreferrer">HandlerMethodArgumentResolver</a></code>, name it <code>CustomHandlerMethodArgumentResolver</code>. To map all request parameters to result object, I had to mark controller's method's param as <code>@RequestBody</code>. </p> <p>That was not enough because Spring's default <code>HandlerMethodArgumentResolvers</code> try to map it first and my resolver wasn't executed. But <a href="https://stackoverflow.com/a/19847526/1329290">this</a> answer pointed how to set priority for my resolver. </p> <p><code>@PostConstruct</code> did not work (not shure why), so I've modified my <code>@Configuration</code> class to implement <code>ApplicationListener&lt;ContextRefreshedEvent&gt;</code>. Here is the code:</p> <pre><code>@Override public void onApplicationEvent(ContextRefreshedEvent event) { RequestMappingHandlerAdapter adapter = event.getApplicationContext().getBean( RequestMappingHandlerAdapter.class); CustomHandlerMethodArgumentResolver resolver = event.getApplicationContext().getBean( CustomHandlerMethodArgumentResolver.class); List&lt;HandlerMethodArgumentResolver&gt; argumentResolvers = new ArrayList&lt;&gt;( adapter.getArgumentResolvers().getResolvers()); List&lt;HandlerMethodArgumentResolver&gt; customResolvers = adapter.getCustomArgumentResolvers(); argumentResolvers.remove(resolver); argumentResolvers.add(0, resolver); adapter.setArgumentResolvers(argumentResolvers); } </code></pre> <p>Of course <code>CustomHandlerMethodArgumentResolver</code> <code>.supportsParameter(MethodParameter)</code> checks if actual situation should be processed in custom or default way - that depends on requirements.</p> <p>Thank you <code>@Ralph</code> for lightning fast help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload