Spring JPA: keeping offset time zone when using OffsetDateTime objects
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 6 Jul 2016 20:07:13 +0000 (22:07 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 6 Jul 2016 20:07:13 +0000 (22:07 +0200)
SpringJava/JPA/src/main/resources/spring-configuration/mvc/rest/rest-config.xml

index 16a44fa..e8cc1a8 100644 (file)
         <property name="featuresToDisable">
             <array>
                 <util:constant static-field="com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES"/>
+                
+                <!-- Useful when using Java 8 objects like OffsetDateTime.
+                        I want to keep the offset in time zone if it exists.
+                        
+                        LIKE THIS ONE: 2014-07-03 23:27:36+0100
+                -->
+                <util:constant static-field="com.fasterxml.jackson.databind.DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE"/>
+                
                 <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION"/>
             </array>
         </property>