<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0" -->

---
title: Spring Boot 4 + jSpecify : Say Goodbye to...
description: A walkthrough shows how JSpecify, a new nullability annotation standard backed by Google, JetBrains, Microsoft, Oracle and others, helps eliminate...
canonical: https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions | daily.dev
og:description: A walkthrough shows how JSpecify, a new nullability annotation standard backed by Google, JetBrains, Microsoft, Oracle and others, helps eliminate...
og:url: https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0
og:image: https://api.daily.dev/og/posts/rkJAGJYS0.png
og:image:alt: Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions

**[SivaLabs \(YouTube\)](https://daily.dev/sources/sivalabs-youtube)** · 15 min read · 0 upvotes · 0 comments

## Summary

A walkthrough shows how JSpecify, a new nullability annotation standard backed by Google, JetBrains, Microsoft, Oracle and others, helps eliminate NullPointerExceptions in Java. It covers the @NullMarked and @Nullable annotations, how IntelliJ's data flow analysis warns about potential null issues, and how to enforce these checks at build time using the Maven compiler plugin with error-prone and NullAway. It also demonstrates that Spring Framework 7 and Spring Boot 4 ship with JSpecify support out of the box, adding nullable annotations throughout their codebases so null violations are caught at compile time rather than at runtime.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=p3v8wJG3-zo>

## Questions this post answers

### Does Spring Boot 4 support JSpecify null-safety annotations out of the box?

Yes, Spring Framework 7 and Spring Boot 4 provide out-of-the-box support for JSpecify, adding a transitive dependency on the JSpecify library so developers don't need to add it manually. Spring's own codebase and most Spring portfolio projects have been annotated with @Nullable and other JSpecify annotations, so passing null where a framework component expects a non-null value produces a detectable nullability violation.

_Developers planning a Spring Boot upgrade can track framework nullability changes like this on daily.dev._

### How do I enforce JSpecify null-safety checks as build failures instead of just IDE warnings?

Configure the Maven compiler plugin with the error-prone and NullAway annotation processors, setting NullAway to check only packages marked with @NullMarked. With this configuration, dereferencing a nullable value without a null check, or passing null into a non-null parameter, causes the build to fail at compile time rather than only showing an IDE warning.

_Teams enforcing null safety in Java builds can follow tooling changes like this via daily.dev._

### What is the @NullMarked annotation in JSpecify and what does it do to method return types?

Placing @NullMarked in a package-info.java file makes every input argument, return type, and field in that package non-nullable by default. Returning or accepting a genuine null value then requires explicitly annotating the specific parameter, field, or return type with @Nullable, otherwise IntelliJ and NullAway flag it as a violation of the assumed non-null contract.

_Developers adopting stricter null contracts in Java can keep up with patterns like this on daily.dev._

## Similar posts on daily.dev

- [Null-Safe applications with Spring Boot 4](https://daily.dev/posts/null-safe-applications-with-spring-boot-4-ufnxqhfid) · Spring · 133 upvotes · 0 comments
- [One Could Simply Add Nullability Check Support… Without Even Noticing It](https://daily.dev/posts/one-could-simply-add-nullability-check-support-without-even-noticing-it-t5jmmum79) · JetBrains · 7 upvotes · 0 comments
- [Micronaut 5 adoption of the JSpecify nullability annotations](https://daily.dev/posts/micronaut-5-adoption-of-the-jspecify-nullability-annotations-jhrgtm2a1) · Micronaut Framework · 9 upvotes · 0 comments
- [Spring Boot 4: Leaner, Safer Apps and a New Kotlin Baseline](https://daily.dev/posts/spring-boot-4-leaner-safer-apps-and-a-new-kotlin-baseline-o5dkpro0n) · JetBrains · 30 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#spring-boot](https://daily.dev/tags/spring-boot)

[View this post on daily.dev](https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions","url":"https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0"},"datePublished":"2026-09-27T07:26:40.992Z","dateModified":"2026-09-27T07:53:38.829Z","description":"A walkthrough shows how JSpecify, a new nullability annotation standard backed by Google, JetBrains, Microsoft, Oracle and others, helps eliminate...","image":"https://i.ytimg.com/vi/p3v8wJG3-zo/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/p3v8wJG3-zo/sddefault.jpg","isAccessibleForFree":true,"articleSection":"SivaLabs (YouTube)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SivaLabs (YouTube)","logo":"https://media.daily.dev/image/upload/s--8ATVo4an--/f_auto,q_auto/v1790493987/logos/sivalabs-youtube?_a=BAMAMicg0","url":"https://daily.dev/sources/sivalabs-youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,spring-boot","timeRequired":"PT15M","video":{"@type":"VideoObject","name":"Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions","description":"A walkthrough shows how JSpecify, a new nullability annotation standard backed by Google, JetBrains, Microsoft, Oracle and others, helps eliminate...","thumbnailUrl":"https://i.ytimg.com/vi/p3v8wJG3-zo/sddefault.jpg","uploadDate":"2026-09-27T07:26:40.992Z","duration":"PT15M","url":"https://api.daily.dev/r/rkJAGJYS0","embedUrl":"https://www.youtube.com/embed/p3v8wJG3-zo"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SivaLabs (YouTube)","item":"https://daily.dev/sources/sivalabs-youtube"},{"@type":"ListItem","position":3,"name":"Spring Boot 4 + jSpecify : Say Goodbye to NullPointerExceptions"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-boot-4-jspecify-say-goodbye-to-nullpointerexceptions-rkjagjys0#faq","mainEntity":[{"@type":"Question","name":"Does Spring Boot 4 support JSpecify null-safety annotations out of the box?","acceptedAnswer":{"@type":"Answer","text":"Yes, Spring Framework 7 and Spring Boot 4 provide out-of-the-box support for JSpecify, adding a transitive dependency on the JSpecify library so developers don't need to add it manually. Spring's own codebase and most Spring portfolio projects have been annotated with @Nullable and other JSpecify annotations, so passing null where a framework component expects a non-null value produces a detectable nullability violation. Developers planning a Spring Boot upgrade can track framework nullability changes like this on daily.dev."}},{"@type":"Question","name":"How do I enforce JSpecify null-safety checks as build failures instead of just IDE warnings?","acceptedAnswer":{"@type":"Answer","text":"Configure the Maven compiler plugin with the error-prone and NullAway annotation processors, setting NullAway to check only packages marked with @NullMarked. With this configuration, dereferencing a nullable value without a null check, or passing null into a non-null parameter, causes the build to fail at compile time rather than only showing an IDE warning. Teams enforcing null safety in Java builds can follow tooling changes like this via daily.dev."}},{"@type":"Question","name":"What is the @NullMarked annotation in JSpecify and what does it do to method return types?","acceptedAnswer":{"@type":"Answer","text":"Placing @NullMarked in a package-info.java file makes every input argument, return type, and field in that package non-nullable by default. Returning or accepting a genuine null value then requires explicitly annotating the specific parameter, field, or return type with @Nullable, otherwise IntelliJ and NullAway flag it as a violation of the assumed non-null contract. Developers adopting stricter null contracts in Java can keep up with patterns like this on daily.dev."}}]}
```

