title: spring validation for requestparam not working
body: <p>I am trying to validate my parameter in controller using @Min(1) annotation. When I test it in unit test, it comes as 200. I am not sure what I am doing wrong. Here is my code:</p>
  <p>Controller:</p>
  <pre><code>@GetMapping(produces = &quot;application/json&quot;)
      public Response search(@RequestParam(name = &quot;firstname&quot;, required = false) String firstName,
          @RequestParam(name = &quot;lastname&quot;, required = false) String lastName, @RequestParam(&quot;ibid&quot;) @Min(1) long ibId,
          @RequestParam(name = &quot;workstationids&quot;, required = false) List&lt;Long&gt; workstationIds,
          @RequestParam(&quot;timerange&quot;) int timeRange,
          @RequestParam(name = &quot;receivingstatus&quot;, required = false) String receivingStatus,
          @RequestParam(name = &quot;displaystart&quot;, required = false) Integer displayStart,
          @RequestParam(name = &quot;displaylength&quot;, required = false) Integer displayLength,
          @RequestParam(&quot;timezone&quot;) @NotBlank String timeZone) {
          ...
          ...
  </code></pre>
  <p>Test:</p>
  <pre><code>@Test
      public void searchWithInvalidParams() throws Exception {
          mockMvc.perform(get(BASE_URL)
              .param(COLUMN_IB_ID, INVALID_IB_ID_VALUE) //invalid ib id is &quot;-1&quot;
              .param(COLUMN_TIME_RANGE, TIME_RANGE_VALUE)
              .param(COLUMN_TIME_ZONE, TIME_ZONE)
              .andExpect(status().isBadRequest());
      }
  </code></pre>
  <p>I am expecting it to return 400, but result is 200.</p>
  <p>Update:
  So I added @Validated in controller and added dependency to pom and it still doesn't work(still 200)</p>
  <p>my pom:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;com.nuance.powershare&lt;/groupId&gt;
          &lt;artifactId&gt;psh-app-dispatch-reporter&lt;/artifactId&gt;
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;psh-app-dispatch-reporter-service&lt;/artifactId&gt;
      &lt;properties&gt;
          &lt;sqljdbc4.version&gt;4.0.0&lt;/sqljdbc4.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.nuance.powershare&lt;/groupId&gt;
              &lt;artifactId&gt;psh-lib-dispatch-reporter-model&lt;/artifactId&gt;
              &lt;version&gt;${project.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.microsoft.sqlserver&lt;/groupId&gt;
              &lt;artifactId&gt;sqljdbc4&lt;/artifactId&gt;
              &lt;version&gt;${sqljdbc4.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.validator&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;6.0.10.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.assertj&lt;/groupId&gt;
              &lt;artifactId&gt;assertj-core&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  
  </code></pre>