Backend Development 6 min read

New Features in Spring Boot 2.7.0

Spring Boot 2.7.0 introduces major enhancements such as a new @AutoConfiguration annotation, upgraded Flyway modules, H2 2.1 support, GraphQL starter, Podman integration, Cache2k auto‑configuration, and several deprecations and test annotation improvements, providing a comprehensive update for Java backend developers.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
New Features in Spring Boot 2.7.0

Spring Boot 2.7.0 was released after a long wait, bringing many new features and improvements over the previous 2.6.x and 2.5.x releases.

Changes to Auto‑Configuration

Spring Boot 2.7 introduces a new @AutoConfiguration annotation that replaces @Configuration for auto‑configuration classes and allows ordering via after/afterNames/before/beforeNames attributes, superseding @AutoConfigureAfter and @AutoConfigureBefore .

Testing Auto‑Configuration

When writing tests for custom auto‑configuration, follow the same registration approach and refer to the spring‑boot‑test‑autoconfigure module. The @SpringBootTest properties attribute and @TestPropertySource now have higher precedence than command‑line arguments.

New Flyway Module

Spring Boot 2.7 upgrades Flyway to 8.5 and extracts support for several databases into separate modules: flyway‑firebird, flyway‑mysql, and flyway‑sqlserver. Add the corresponding dependency if you use Flyway with those databases.

H2 Database 2.1

The embedded H2 database is upgraded to version 2.1.120, which is not backward‑compatible with 2.x and includes many security fixes.

Deprecations from Spring Boot 2.5

Classes, methods, and properties deprecated in 2.5 have been removed in 2.7; ensure your code does not rely on them. Note that Spring Boot 2.5 has reached end‑of‑life and no longer receives free security updates.

Spring GraphQL Support

Spring Boot 2.7 adds official support for Spring GraphQL via the starter spring-boot-starter-graphql , enabling GraphQL API development.

Opaque Token Introspection Optimization

If you use opaque token introspection in an OAuth2 resource server, the auto‑configuration no longer requires the com.nimbusds:oauth2-oidc-sdk dependency, allowing you to remove it.

Couchbase and Elasticsearch Test Annotations

New test annotations @DataCouchbaseTest and @DataElasticsearchTest are provided for testing Couchbase and Elasticsearch databases respectively.

Podman Support

The Maven and Gradle plugins now support using Podman as an alternative container engine when building images with Cloud Native Buildpacks.

Cache2k Support

Cache2k is now managed and auto‑configured; you can customize the default cache by defining a Cache2kBuilderCustomizer bean.

Jackson Mixin Simplification

Jackson auto‑configuration now scans the application’s classpath for classes annotated with @JsonMixin and registers them with the ObjectMapper automatically.

The author also invites readers to like, share, and follow the “码猿技术专栏” public account to obtain related PDF collections.

backendJavaSpring BootGraphQLAuto‑ConfigurationFlywayCache2k
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

0 followers
Reader feedback

How this landed with the community

login 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.