Skip to content

Spring Boot with Java 9 and above

Stéphane Nicoll edited this page Apr 24, 2018 · 12 revisions

This page gathers the things that you need to know if you want to run Spring Boot apps on Java 9 and above.

Requirements

Spring Boot 2 is the first version to support Java 9 (Java 8 is also supported). If you are using 1.5 and wish to use Java 9 you should upgrade to 2.0 as we have no plans to support Java 9 on Spring Boot 1.5.x.

Note
Java 10 is supported as of Spring Boot 2.0.1.RELEASE. We intend to support Java 11 as of Spring Boot 2.1.x

AspectJ

With Java 9, if you need to weave classes from the JDK, you need to use AspectJ 1.9. Spring AOP should work fine in most cases with AspectJ 1.8 (the default in Spring Boot 2.0).

JAXB

When upgrading you may face the following:

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

Hibernate typically requires JAXB that’s no longer provided by default. You either need to add a dependency to your project:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

Or you could add the java.xml.bind module to restore this functionality with Java9.

Known limitations

These libraries do not have full support for Java 9 yet:

  • Apache Cassandra, see #10453

Clone this wiki locally