title: Spring Boot : Different ObjectMapper instances for Request and Response
body: <p>I have following controller in my spring boot application:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.POST)
  public ResponseEntity&lt;ResponseDto&lt;MyClass&gt; process(@RequestBody RequestDto&lt;MyClass&gt; request){
      return null;
  }
  </code></pre>
  
  <p><code>MyClass</code> has a field, let's say 'myField' and I want different <code>NamingStrategy</code>configuration for request and response for this field (this is because I don't want to create a new class just for one field). I have configured <code>ObjectMapper</code> instance as below:</p>
  
  <pre><code>@Bean
  public ObjectMapper objectMapper(){
      ObjectMapper objectMapper = new ObjectMapper();
      objectMapper.setPropertyNamingStrategy(namingStrategy);
      return objectMapper;
  }
  </code></pre>
  
  <p>This will be used both for Request and Response (i.e. deserialization and serialization), is there any way in spring boot by which I can instruct the controller to use different <code>ObjectMapper</code> instances?</p>