title: Mapping query parameters to @ModelAttribute does not respect @JsonProperty name
body: <pre><code>@GetMapping("item")
  public @ResponseBody String get(@ModelAttribute Item item)
  </code></pre>
  
  <p><code>Item</code> has the attributes </p>
  
  <ul>
  <li><p><code>name</code> </p></li>
  <li><p><code>itemType</code></p></li>
  </ul>
  
  <p>When I access <code>/item?name=foo&amp;item_type=bar</code> the <code>item</code> gets 
  populated only with <code>name</code> <strong>not</strong> with <code>itemType</code>. </p>
  
  <p>I tried a bunch of things to get the <code>itemType</code> attribute mapped from <code>item_type</code>.</p>
  
  <ul>
  <li>Added @JsonProperty("item_type") inside <code>Item</code>'s <code>itemType</code> attribute. <a href="https://stackoverflow.com/a/10519316/1419386">Described here</a>.</li>
  <li>Added a JackonConfiguration that sets the propertyNamingStrategy to PropertyNamingStrategy.SNAKE_CASE. <a href="https://stackoverflow.com/a/43271115/1419386">Described here</a>.</li>
  <li>Added spring.jackson.property-naming-strategy=SNAKE_CASE to my Spring Boot application.properties file. <a href="https://stackoverflow.com/a/40730352/1419386">Described here</a></li>
  <li>Added the PropertyNamingStrategy on the <code>Item</code> class level. <a href="https://stackoverflow.com/a/39460108/1419386">Described here</a>.</li>
  </ul>
  
  <p>How can I solve this?</p>
  
  <p>Btw. I only have this problem for incoming not outgoing JSON serialization of <code>Item</code>.</p>
  
  <hr>
  
  <p><strong>Update 04/24/17:</strong></p>
  
  <p>Below a minimal sample to demonstrate the problem:
  When visiting <code>/item</code> you will see that the 'outgoing' JSON serialization works but when visiting <code>/item/search?name=foo&amp;item_type=bar</code> it does not work for 'incoming' JSON deserialization.</p>
  
  <p>Item</p>
  
  <pre><code>package sample;
  
  import java.io.Serializable;
  
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy;
  import com.fasterxml.jackson.databind.annotation.JsonNaming;
  
  @JsonNaming(SnakeCaseStrategy.class)
  public class Item implements Serializable {
      private String name;
      @JsonProperty("item_type")
      private String itemType;
      public Item() { }
      public Item(String name, String itemType) {
          this.name = name;
          this.itemType = itemType;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getItemType() {
          return itemType;
      }
      public void setItemType(String itemType) {
          this.itemType = itemType;
      }
  }
  </code></pre>
  
  <p>ItemController.java</p>
  
  <pre><code>package sample;
  
  import org.springframework.data.domain.Page;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
  import org.springframework.web.bind.annotation.RestController;
  
  @RestController
  @RequestMapping("/item")
  public class ItemController {
      @GetMapping("search")
      public @ResponseBody Page&lt;Item&gt; search(@ModelAttribute Item probe) {
          System.out.println(probe.getName());
          System.out.println(probe.getItemType());
          //query repo by example item probe here...
          return null;
      }
      @GetMapping
      public Item get() {
          return new Item("name", "itemType");
      }   
  }
  </code></pre>
  
  <p>JacksonConfiguration.java</p>
  
  <pre><code>package sample;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
  
  import com.fasterxml.jackson.databind.PropertyNamingStrategy;
  
  @Configuration
  public class JacksonConfiguration {
      @Bean
      public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder() {
          return new Jackson2ObjectMapperBuilder()
                  .propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
      }
  } 
  </code></pre>
  
  <p>SampleBootApplication.java</p>
  
  <pre><code>package sample;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class SampleBootApplication {
      public static void main(String[] args) {
          SpringApplication.run(SampleBootApplication.class, args);
      }
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>logging.level.org.springframework=INFO
  spring.profiles.active=dev
  spring.jackson.property-naming-strategy=SNAKE_CASE
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;sample&lt;/groupId&gt;
      &lt;artifactId&gt;sample&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.2.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.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&lt;/artifactId&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;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;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-cache&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&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-thymeleaf&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;nz.net.ultraq.thymeleaf&lt;/groupId&gt;
                      &lt;artifactId&gt;thymeleaf-layout-dialect&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hsqldb&lt;/groupId&gt;
              &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
              &lt;scope&gt;runtime&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;!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties 
                              file is present --&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;build-info&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;additionalProperties&gt;
                                  &lt;encoding.source&gt;${project.build.sourceEncoding}&lt;/encoding.source&gt;
                                  &lt;encoding.reporting&gt;${project.reporting.outputEncoding}&lt;/encoding.reporting&gt;
                                  &lt;java.source&gt;${maven.compiler.source}&lt;/java.source&gt;
                                  &lt;java.target&gt;${maven.compiler.target}&lt;/java.target&gt;
                              &lt;/additionalProperties&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>