title: Spring Boot Jackson JSR-310 - ZonedDateTime always timestamp
body: <p>Consider this Spring MVC controller started using Spring Boot:</p>
  
  <pre><code>@RequestMapping("/foo")
  public Foo get() {
      return new Foo();
  }
  
  public class Foo {
      @Getter
      @Setter
      private ZonedDateTime time = ZonedDateTime.now();
  }
  </code></pre>
  
  <p>I want to serialize the Foo object with Jackson JSR-310 module. This dependency is on classpath:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-datatype-jsr310&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I also have jackson configuration in my application.properties:</p>
  
  <pre><code>spring.jackson.serialization.write-dates-as-timestamps=false
  </code></pre>
  
  <p>According to jackson documentation it should convert it to ISO datetime format, but I'm still getting a timestamp value...</p>
  
  <pre><code>{
    time: 1508867114.796
  }
  </code></pre>
  
  <p>I have noticed that inside ZonedDateTimeSerializer:</p>
  
  <pre><code>@Override
  public void serialize(ZonedDateTime value, JsonGenerator generator, SerializerProvider provider) throws IOException {
      if (!useTimestamp(provider)) {
          if (shouldWriteWithZoneId(provider)) {
              // write with zone
              generator.writeString(DateTimeFormatter.ISO_ZONED_DATE_TIME.format(value));
              return;
          }
      }
      super.serialize(value, generator, provider);
  }
  </code></pre>
  
  <p><code>useTimestamp(provider)</code> is evaluated to <code>true</code>, so the property in application.properties is ignored.</p>
  
  <p>Any ideas what can be wrong with my code?</p>