1

I'm working with Java 8 Date/Time API (JSR-310) on a brand new Spring Boot (1.5) application. Prior the first public release we can stay on tip of every dependencies and that's why I want to clarify the state of JSR-310 handling on the complete Spring Boot stack.

Boot Starter Web - Jackson serialization

Just add jackson-datatype-jsr310 dependency.

But is this really necessary? If so, why is this not included in the standard bundle?

Boot Starter Data - Hibernate persistence

This is where it gets tricky. I have struggling a bit with that, maybe because I'm using PostgreSQL.

Seems like Java 8 compatibility was added to JDBC for version 4.2, which means:

  • Use a JDBC 4.2 driver (for PostgreSQL, current is 9.4.1212)
  • Override Hibernate version >= 5.2.6, which brings support for JDBC 4.2

Related : PSQLException - spring boot 1.4.1 - spring data jpa - offsetdatetime/localdatetime identified as Bytestream

Everything works as expected, but as of current (Spring Boot 1.5.2) development status, am I doing OK, is there any preferred way?

Thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
LeRiton
  • 313
  • 1
  • 4
  • 10

1 Answers1

0

Regarding you first question: the jsr310 dependency is declared as optional in spring-boot-autoconfigure/pom.xml, meaning it's excluded by default unless you declare the dependency in your projet pom.xml.

I can give you a practical example that justifies its being optional. A few weeks ago, I migrated a Spring Boot project from Java 7 to Java 8. This project used the Joda-Time, with a dependency on jackson-datatype-joda API to manage temporal data. My project worked out of the box, without needing to migrate to the new java.time (jsr310) API beforehand. Afterwards I switched to the java.time API and replaced jackson-datatype-joda dependency with the jackson-datatype-jsr310 one. But in the mean time, I was able to work on some urgent issues than a non-required - though recommended - change of API.

Marc Tarin
  • 3,109
  • 17
  • 49