Should I use @QueryParam or @BeanParam in JAX-RS?
<p>I am thinking of two options for handling query/request parameters:</p>

<ol>
<li>Map individual parameters to corresponding the method parameters:</li>
</ol>

<pre class="lang-java prettyprint-override"><code>@GET
public String blah(@QueryParam("testParam") String testParam) {

}
</code></pre>

<ol start="2">
<li>Map all parameters to the properties of a Java bean:</li>
</ol>

<pre class="lang-java prettyprint-override"><code>@GET
public String blah(@BeanParam RequestParamBean bean) {

}
</code></pre>

<p>The second option seems more attractive as it allows the validation logic of input query parameters to be moved and decoupled from the <code>blah</code> method whose core responsibility should be to process and delegating the validation to a validator should high degree of decoupling (and also SOLID principle, right?).</p>

<p>However, most of the examples I see (in fact, the existing project I am working on) use only the first option. I am wondering if is there any reason why the second option is not widely used? Are there any pitfalls? Is this an anti-pattern? Is this against any best practice?</p>