What Is New in Spring Boot 3.1
Spring Boot 3.1 delivers a significant set of enhancements focused on developer productivity and modern application patterns. This release builds upon the foundation of Spring Boot 3.0 with improved Docker Compose integration, finer-grained observability, and streamlined database initialization.
| Category | Key Changes |
|---|---|
| New Features | Docker Compose Support, Testcontainers at Development Time, Spring Authorization Server Auto-configuration |
| Observability | Built-in MeterRegistry Configuration, Environment Properties for Micrometer, New ApplicationStartup Metrics |
| Data & SQL | JDBC Connection Details, SSL Support for JDBC, Spring Data JDBC Auto-configuration |
| Developer Tools | Restart Trigger File, Spring Boot Loader for Maven and Gradle, Enhanced DevTools Logging |
| Deprecations | Spring Cloud Connectors, Spring Boot 2.x Properties |
How does Spring Boot 3.1 simplify containerized development?
The headline feature is first-class support for Docker Compose. You can now define your application's dependent services like PostgreSQL or Redis in a compose.yaml file at the root of your project, and Spring Boot will automatically start them when the app runs.
In practice, this means you no longer need to manually run docker-compose up in a separate terminal. Spring Boot manages the lifecycle, pulling the images and starting the containers for you. This is a huge win for local development and integration testing, making the inner loop much smoother.
It integrates seamlessly with Testcontainers for more advanced testing scenarios, blurring the lines between simple local development and more complex test environments.
What observability improvements were made in this release?
Spring Boot 3.1 provides more out-of-the-box and customizable observability. A major change is the built-in auto-configuration for MeterRegistry instances, which simplifies sending metrics to various monitoring systems without manual setup.
You now have more control over Micrometer through environment properties, allowing for easier runtime configuration adjustments. New metrics around the ApplicationStartup phase have also been added, giving you deeper insight into application initialization performance.
This matters because it reduces the boilerplate code needed to hook into observability platforms, making it the default, easy path for building production-ready observable applications.
How are database connections handled differently now?
This release introduces a new JdbcConnectionDetails abstraction. This interface provides a clean way to obtain JDBC connections, separating the concern of connection details from the rest of the data source configuration.
A key practical benefit is built-in SSL support for JDBC connections. You can now configure SSL for your database through standard properties, which is essential for secure cloud deployments where encrypted connections are mandatory.
For Spring Data users, auto-configuration for Spring Data JDBC is now included, bringing it in line with the support already available for JPA and other data modules.
What developer experience tweaks should I know about?
Developer Tools (DevTools) got some nice quality-of-life updates. You can now use a trigger file to control application restarts instead of relying solely on classpath changes, which is useful for certain build setups or frontend development workflows.
The logging output from DevTools is now less verbose by default, cutting down on console noise during development. Furthermore, the Spring Boot Loader is now available for both Maven and Gradle, providing a unified way to build executable archives.
These changes might seem small individually, but together they significantly polish the daily development experience, removing minor friction points.
FAQ
Do I have to use Docker Compose with Spring Boot 3.1?
No, it's completely optional. The integration is auto-configured if it finds a compose.yaml file in your project. If the file isn't present, the feature remains inactive, so there's no overhead for existing projects.
I use Spring Security. What does the Authorization Server auto-configuration mean for me?
It provides automatic setup for a Spring Authorization Server, allowing you to stand up a full OAuth 2.0 authorization server with minimal configuration. This is great for projects that need to issue their own tokens without embedding a third-party solution.
Is Spring Boot 3.1 compatible with Java 17?
Yes, absolutely. Spring Boot 3.1 requires Java 17 or above, continuing the baseline set by Spring Boot 3.0. It also supports and is tested against Java 20.
What happened to Spring Cloud Connectors?
Spring Cloud Connectors have been deprecated in this release. The recommendation is to move to the new Cloud Native buildpacks or other modern deployment and binding mechanisms for connecting to cloud services.
How disruptive is upgrading from Spring Boot 2.7 to 3.1?
It's a major version jump, so some planning is required. You'll need to be on Java 17+, and you should carefully review the migration guide for breaking changes in both Spring Boot 3.0 and 3.1, especially around deprecated property handling and package renaming from Jakarta EE.