I'm looking for a module for the new JDK8 java.time classes. I have looked through the FasterXML GitHub Project Listing and presently found none.
As I understand Jackson is still being compiled against JDK6 so can not use these classes directly and must have this built as a separate module, as was required with Joda.
I don't mind starting the project, though looking to see if any other efforts were already underway.
You just need to import the jsr310 module.
If module auto scan is not enable in your project, you will need to register it:
My bad, I was looking for a
jackson-datatype-jdk8
as was for jackson-datatype-jdk7, however the project was actually created under the JSR name jackson-datatype-jsr310.The most complete listing of datatype modules would be found from Jackson "portal" page at Github:
https://github.com/FasterXML/jackson
which does list "JSR-310: support for "Java 8 Dates". Naming is bit opaque, but it refers to the standardization process, via JSR that should be finalized to produce the new Java8 Date API (if it's not already final; process has taken a while).
Direct link is: https://github.com/FasterXML/jackson-datatype-jsr310
If you use Spring Boot 2 and depends on the
spring-boot-starter-web
starter, you would have as dependencies both : the deprecated (jackson-datatype-jsr310) and the actual (jackson-datatype-jdk8).As already mentioned, Jackson-Datatype-JSR310 provides support for Java 8 Time.
Since Jackson 2.6.0 the "old" JSR310Module is deprecated. It is replaced by JavaTimeModule. Maven dependency is the same (you can find the current version in Maven Central):
You have to register the module like this:
JavaTimeModule Source at GitHub
JavaTimeModule Usage