Spring Boot 4 Brings Full Null‑Safety Across the Spring Ecosystem with JSpecify

Spring Boot 4 and the entire Spring family now implement full null‑safety by adopting JSpecify annotations, enabling compile‑time checks that eliminate NullPointerException, while providing a roadmap for future Java platform null‑type support and detailing the upgraded modules and tooling.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
Spring Boot 4 Brings Full Null‑Safety Across the Spring Ecosystem with JSpecify

Spring announced that Spring Boot 4 and the entire Spring ecosystem now fully support null‑safety by adopting the JSpecify annotation standard, allowing developers to eliminate NullPointerException at compile time.

Historically, Java lacks explicit nullability, so NPEs were caught only at runtime via comments or IDE hints. JSpecify defines standard annotations such as @NullMarked, @Nullable and @NonNull to express nullability contracts.

These annotations are tool‑agnostic and recognized by IntelliJ IDEA, NullAway, Eclipse, etc. Spring has deprecated its own org.springframework.lang annotations and migrated to JSpecify.

After months of work, the following Spring projects now provide null‑safe APIs:

Spring Boot 4.0

Spring Framework 7.0

Spring Data 4.0

Spring Security 7.0

Spring Batch 6.0

Spring Integration 7.0

Spring Kafka 4.0

Spring GraphQL 2.0

Spring Web Services 5.0

Spring HATEOAS 3.0

Micrometer 1.16

Reactor 2025.0

Future releases will extend null‑safety to components such as Spring AI, Spring Session, and Spring LDAP.

Developers can use the Gradle Nullability plugin together with Spring Boot 4 and IntelliJ IDEA 2025.3 (upcoming) to enforce null contracts during compilation, effectively preventing NPEs.

The move prepares the Spring ecosystem for upcoming Java platform features like Null‑Restricted and Nullable types, which will eventually enable runtime performance optimizations.

References

JSpecify project: https://github.com/jspecify/jspecify

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaSpring BootannotationsFrameworknull safetyJSpecify
Su San Talks Tech
Written by

Su San Talks Tech

Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.

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.