In my previous post, Spring Boot 2.0 New Features: The 3 Most Important Changes You Must Know About, I pointed out the one of the notable changes coming with Spring Boot 2 will be infrastructure updates. This post enumerates these updates so that you can see their impact once before you would upgrade.
Releasing a new major version gave the Spring team the opportunity to rebase the codebase upon Java 8 and use its new features. Therefore Spring Boot 2.0 requires Java 8 or later, consequently it doesn’t support Java 6 and Java 7 any more, because they reached their end of life anyway.
Spring Boot 2 fully supports it and there is a dedicated page Spring Boot with Java 9 that provides more details if you want to run Spring Boot apps with Java 9.
Spring Boot 2.0 builds on and requires Spring Framework 5.0. Altought Spring 5 has been generally available since September of 2017, probably most projects will start to adapt it when Spring Boot 2.0 hits GA. Spring 5 introduces a number of nice refinements as well and one of the most noteworthy of its new features is its extensive support for building reactive applications in a next post.
The minimum supported version of Jetty is 9.4.
The minimum supported version of Tomcat is 8.5
You can configure SSL for your WebFlux application with
server.ssl.* configuration properties and all available servers
(Tomcat, Jetty, Undertow and Reactor Netty) supports this configuration.
Spring Boot also enables your MVC or WebFlux applications to use HTTP/2 by
server.http2.enabled. It’s supported for Tomcat, Undertow and Jetty. Depending on your choice of server
restrictions and prerequisites can apply.
Maven projects are compiled with the
-parameters compiler flag by default.
Spring Boot requires Gradle 4.x. Spring Boot’s Gradle plugin has been largely rewritten to enable a number of significant improvements. You can read more about the plugin’s capabilities in its reference and api documentation.
BootRun task provides properties for configuring the application’s arguments (
args) and JVM arguments (
and more advanced configuration is available via
execSpec. See the
Gradle plugin’s documentation
for more details. Based on user feedback, the
BootRun task is once again a subclass of Gradle’s
It can be configured in the same way as any other
The default connection pool has changed from Tomcat to HikariCP. If you
are using Hikari in an environment where
tomcat-jdbc is provided, you can remove the
Similarly, if you want to stay with the Tomcat connection pool, simply add the following to your configuration:
Liquibase and Flyway configuration keys were moved to the
spring namespace (i.e.
If only a custom
user is provided, the auto-configuration reuses the standard datasource properties rather
than ignoring them. This allows you to create a custom
DataSource for the purpose of the migration with only the
If Flyway or Liquibase is managing the schema of your
DataSource and you’re using an embedded database,
Spring Boot 2 will automatically switch off Hibernate’s automatic DDL feature.
Database initialization for Spring Batch,
Spring Session and Quartz occurs by
default only when using and embedded database. The
enabled property has been replaced with a more expressive enum.
For example, if you want to always perform Spring Batch initialization you can set
DataSource initialization is only enabled for embedded data sources and will switch off as soon as you’re using a
production database. Furthermore the new
offers more control.
Instrumentation takes care of monitoring all available data sources and publishes metrics (min, max and usage) metrics for each.
If you were extending Spring Boot’s JPA configuration to register mapping resources, there is a
JdbcTemplate that Spring Boot auto-configures can be customized via the
NamedParameterJdbcTemplate that is auto-configured reuses the
JdbcTemplate behind the scenes.
Spring Boot detects the jOOQ dialect automatically based on the
(similarly to what is done for the JPA dialect). Also a
@JooqTest has been introduced to ease testing where only jOOQ
has to be used.
The minimum supported version of Hibernate is 5.2. Read Hibernate 5.2 Migration Guide to find out how to upgrade.
For advanced scenario, you can define the
PhysicalNamingStrategy to use as regular
beans in the context.
It is possible to customize the
properties Hibernate uses in a more fine grained way by exposing a
spring.data.cassandra exposes pooling options.
Support for Spring Data reactive repositories is available for Couchbase and
spring-boot-starter-data-couchbase-reactive is available to easily get started.
If the InfluxDB java client and the
spring.influx.url is set, an
is automatically configured. Support for credentials is available as well. The
health endpoint can monitor an
It is possible to expose a
RedisCacheConfiguration to take control over the
RedisCacheManager. A new annotation
@DataRedisTesthas also been introduced.
Spring Boot 2 requires Elasticsearch 5.4 from now on. In line with Elastic’s announcement that embedded Elasticsearch
is no longer supported, auto-configuration of a
been removed. A
TransportClient can be auto-configured by using
the addresses of one or more nodes to connect to.
It is possible to apply advanced customizations to the MongoDB client
that Spring Boot auto-configures by defining a bean of type
Mockito 1.x is no longer supported for
@SpyBean. If you don’t use
to manage your dependencies you should upgrade to
RestTemplate extensions are also available for
TestRestTemplate to make the developer experience consistent.
GenericConverter beans are automatically scanned with
Reference: Spring Boot 2.0 Release Notes.