What’s New in Spring Boot 2.5? A Deep Dive into Features and Upgrades

Spring Boot 2.5 introduces major enhancements such as Java 16 support, Gradle 7 and Jetty 10 compatibility, HTTP/2 over TCP, a revamped datasource initialization mechanism, environment‑variable prefixes, Docker build improvements, layered WARs, actuator endpoint changes, extensive dependency upgrades, and several deprecations, while urging careful migration.

macrozheng
macrozheng
macrozheng
What’s New in Spring Boot 2.5? A Deep Dive into Features and Upgrades

Preface

About a month after the Spring Boot 2.4.5 release, Spring Boot announced three new versions, with 2.5.0 being the most significant upgrade in the past six months.

Spring Boot 2.5 release image
Spring Boot 2.5 release image

Spring Boot released three versions:

Spring Boot 2.5.0

Spring Boot 2.4.6

Spring Boot 2.2.13.RELEASE

This article focuses on Spring Boot 2.5.0; the other two are mainly bug‑fix and documentation updates.

Maven dependency example:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.0</version>
    <type>pom</type>
</dependency>

Note: starting with 2.4.x the .RELEASE suffix is omitted.

Spring Boot 2.5 New Features Overview

1. Support Java 16

Spring Boot 2.5 runs on Java 16 while remaining compatible with Java 8.

2. Support Gradle 7

The Spring Boot Gradle plugin now supports Gradle 7.0.x and has been tested against it.

3. Support Jetty 10

Embedded Jetty 10 is supported (requires Java 11); Jetty 9 remains the default.

4. Support HTTP/2 over TCP (h2c)

All embedded containers can serve HTTP/2 over plain TCP without additional configuration.

5. New datasource initialization mechanism

1) Datasource adjustments

Old spring.datasource.* properties are deprecated and replaced by spring.sql.init.*:

spring.datasource.*

New configuration:

spring.sql.init.*

2) Flyway and Liquibase adjustments

When defining spring.flyway.url or spring.liquibase.url, username and password must be provided. Previously these values were derived from spring.datasource, which could cause issues for custom datasources. Custom datasource usage with Liquibase now employs SimpleDriverDataSource instead of a pooled datasource, improving initialization efficiency.

6. Environment variable prefix

Spring Boot 2.5 allows a prefix for system environment variables, preventing name collisions when running multiple applications.

Usage example:

SpringApplication application = new SpringApplication(Javastack.class);
application.setEnvironmentPrefix("javastack");
application.run(args);

Only variables starting with javastack- are bound, e.g.:

javastack-id
javastack-name
javastack-age

7. Enhanced Docker image building

Both Maven and Gradle plugins now support:

1) Custom build packages

2) Volume binding during Docker build

3) Packaging an executable WAR into a Docker image

8. Layered WARs

The plugins can create layered WAR files, similar to layered JARs introduced in Spring Boot 2.3, improving Docker build speed.

9. Actuator endpoint and metric changes

1) The /info endpoint is no longer exposed by default and requires authentication when Spring Security is used.

2) New /quartz endpoint provides detailed Quartz job and trigger data.

3) The /startup endpoint now supports GET requests, which keep events in memory.

4) The /actuator/prometheus endpoint returns standard Prometheus and OpenMetrics responses.

5) Micrometer metrics are generated for Spring Data repositories.

6) Automatic metrics for MongoDB connection pool and client commands are added.

10. Documentation UI updates and dark mode

The Spring project homepage and Spring Boot documentation now offer a dark‑mode theme.

Spring Boot documentation dark mode
Spring Boot documentation dark mode

Spring Boot 2.5 Dependency Upgrades

Spring projects upgraded:

Spring Data 2021.0

Spring HATEOAS 1.3

Spring Integration 5.5

Spring Kafka 2.7

Spring Retry 1.3

Spring Security 5.5

Spring Session 2021.0

Third‑party libraries upgraded:

Kotlin 1.5

Groovy 3.0

Flyway 7.7

Liquibase 4.2

Jackson 2.12

Kafka 2.7

Cassandra Driver 4.10

Embedded Mongo 3.0

Hibernate Validator 6.2

Jersey 2.33

Mockito 3.7

MongoDB 4.2

JUnit Jupiter 5.7

Elasticsearch 7.12

Spring Boot 2.5 Feature Deprecations

1) Automatic configuration for Spring Data Solr was removed.

2) Classes ActuatorMediaType and ApiVersion were removed from org.springframework.boot.actuate.endpoint.http.

3) jOOQ *Provider callbacks are deprecated; use DefaultConfigurationCustomizer instead.

4) EntityManagerFactoryDependsOnPostProcessor moved from org.springframework.boot.autoconfigure.data.jpa to org.springframework.boot.autoconfigure.orm.jpa.

Conclusion

The Spring Boot 2.5 release brings substantial changes, especially the new datasource mechanism, actuator endpoint updates, and many framework version upgrades.

Do not upgrade lightly; review the changes thoroughly and test extensively before adopting the new version.

For more details, refer to the official release notes: Spring Boot 2.5 Release Notes

Dockerbackend developmentdependency managementSpring BootactuatorJava 16
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.