Skip to content

Comments

Add Spring Framework 7 null safety with JSpecify enterprise pattern#61

Merged
brunoborges merged 3 commits intomainfrom
copilot/add-null-safety-check-spring-7
Feb 20, 2026
Merged

Add Spring Framework 7 null safety with JSpecify enterprise pattern#61
brunoborges merged 3 commits intomainfrom
copilot/add-null-safety-check-spring-7

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Spring 7 migrates from its own org.springframework.lang null annotations to JSpecify, a cross-ecosystem standard. This adds an enterprise pattern demonstrating the contrast.

New pattern: enterprise/spring-null-safety-jspecify

Before (Spring 5/6) — every non-null element requires explicit annotation:

import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

public class UserService {
    @Nullable
    public User findById(@NonNull String id) { ... }

    @NonNull
    public User save(@NonNull User user) { ... }
}

After (Spring 7)@NullMarked makes non-null the default; only exceptions need @Nullable:

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class UserService {
    public @Nullable User findById(String id) { ... }

    public User save(User user) { ... }
}

File changes

  • content/enterprise/spring-null-safety-jspecify.json — new pattern (id=110, difficulty=intermediate, requires Java 17+), with whyModernWins covering non-null-by-default semantics, JSpecify as a cross-framework standard, and improved static analysis tooling (NullAway, Error Prone, IntelliJ)
  • content/enterprise/jdbc-resultset-vs-jpa-criteria.json — updated next to link into the new pattern, extending the enterprise navigation chain
Original prompt

This section details on the original issue you should resolve

<issue_title>Spring Framework 7 with Null Safety check</issue_title>
<issue_description>Spring Framework 7 now has support for null safety check with JSpecify. Add a comparison with how one would do before (versions 5 and 6 of Spring Framework) versus version 7 now.

Place under category enterprise</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add null safety check comparison for Spring Framework 7 Add Spring Framework 7 null safety with JSpecify enterprise pattern Feb 20, 2026
Copilot AI requested a review from brunoborges February 20, 2026 07:59
@brunoborges brunoborges marked this pull request as ready for review February 20, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring Framework 7 with Null Safety check

2 participants