title: Spring Controller +Jackson + Joda Date Time: How maintain Timezone?
body: <h2>My Configuration</h2>
  
  <p>Spring 3.2.5.Release</p>
  
  <p>Jackson 2.3.0:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-datatype-joda&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Joda Time 2.3:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;joda-time&lt;/groupId&gt;
      &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
      &lt;version&gt;2.3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>I used this global Spring MVC global settings:</strong></p>
  
  <pre><code>&lt;!--Jackson - objectMapper format date setting --&gt;
  &lt;beans:bean id="objectMapper"
      class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"
      p:indentOutput="true" p:simpleDateFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ"&gt;
  &lt;/beans:bean&gt;
  
  &lt;!--Jackson - registerModule JodaModule --&gt;
  &lt;beans:bean
      class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
      p:targetObject-ref="objectMapper" p:targetMethod="registerModule"&gt;
      &lt;beans:property name="arguments"&gt;
          &lt;beans:list&gt;
              &lt;beans:bean class="com.fasterxml.jackson.datatype.joda.JodaModule" /&gt;
          &lt;/beans:list&gt;
      &lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  
  &lt;!-- Spring MVC:  setting objectMapper in converter MappingJackson2HttpMessageConverter--&gt;
  &lt;mvc:annotation-driven&gt;
      &lt;mvc:message-converters&gt;
          &lt;beans:bean
              class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"&gt;
              &lt;beans:property name="objectMapper" ref="objectMapper" /&gt;
          &lt;/beans:bean&gt;
      &lt;/mvc:message-converters&gt;
  &lt;/mvc:annotation-driven&gt;
  </code></pre>
  
  <h2>My Problem:</h2>
  
  <p><strong>Jackson (I suppose..) overwrite the timezone +8:00 with Z.</strong></p>
  
  <p>In fact, if i send a JSON request with a date with <strong>+8:00</strong> timezone:</p>
  
  <pre><code>{
      "date": "2014-01-28T23:00:00.000+08:00"
  }
  </code></pre>
  
  <p>....the request is handle by a classic spring MVC @Controller:</p>
  
  <pre><code>public JsonResponse insert(@RequestBody BeanDto beanWithDate)
  </code></pre>
  
  <p>BeanDto has "DateTime date", property.</p>
  
  <p>The property date of BeanDto has this value: </p>
  
  <pre><code>date = 2014-01-28T23:00:00.000Z
  </code></pre>
  
  <h2>My question:</h2>
  
  <p><strong>How to maintain the json request's Timezone?</strong></p>
  
  <p>Another little question:
  Is there a more smart solution for manage dateTime format in spring mvc configuration file?</p>
  
  <p>Thank you,
  Alessandro</p>