Null-safe applications with Spring Boot 4
summary
Spring Boot 4 and the Spring portfolio adopt JSpecify annotations to make APIs explicitly nullable or non-null, deprecating org.springframework.lang and shipping package-level @NullMarked default non-null markings; migration uses OpenRewrite recipes or stepwise package-by-package edits. Build-time checking runs with NullAway + Error Prone (Gradle/Maven configs shown) and requires recent JDKs (17.0.19+, 21.0.8+, or 25). An agentic loop with custom AI skills can auto-infer annotations, and a runtime Newness API lets code inspect nullability; Kotlin 2.1 maps JSpecify automatically.
AI-written summary · about
chapters (21)
- 0:00Null safety in Spring Boot 4
- 1:29JSpecify and its role
- 3:14Migration from Spring annotations
- 4:40Spring Boot 4 null-safe APIs
- 7:09Explicit nullability benefits
- 9:37Why Optional is not a general-purpose solution
- 13:31Making projects null-safe
- 14:12JSpecify docs and mental model
- 15:37JSpecify dependency setup
- 16:43Annotating packages with @NullMarked
- 17:45Using @Contract semantics
- 19:53Class-level nullability
- 21:41Arrays and varargs with JSpecify
- 23:49NullAway build-time checks
- 27:00NullAway Gradle/Maven setup
- 29:08Automating null safety with agents
- 31:56Agent skills for JSpecify
- 33:42Agentic loop with NullAway
- 35:28Runtime nullness with newness API
- 36:53Future of null safety
- 41:29Q&A
related talks
01h 00mNull Safety in Spring Applications With JSpecify and NullAway
41mNull Safety in Java with JSpecify and NullAway
53mNulls are dead
36mJSpecify: Getting Rid of the Billion-Dollar Mistake in Java for Good This Time
44mThe long good-bye to NPE
01h 14mSpring I/O 2025 Keynote
36mRetrofitting Null-Safety into Java
52mPreventing null pointer exceptions at compile time
