diff --git a/smoke-test/spring-boot-smoke-test-war/build.gradle b/smoke-test/spring-boot-smoke-test-war/build.gradle index 7f4d213a49b..6706089d9c9 100644 --- a/smoke-test/spring-boot-smoke-test-war/build.gradle +++ b/smoke-test/spring-boot-smoke-test-war/build.gradle @@ -35,3 +35,7 @@ dependencies { testImplementation(project(":starter:spring-boot-starter-test")) } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} diff --git a/smoke-test/spring-boot-smoke-test-war/src/test/java/smoketest/war/WarApplicationResourceTests.java b/smoke-test/spring-boot-smoke-test-war/src/test/java/smoketest/war/WarApplicationResourceTests.java index e615655d104..c5c7febd6bf 100644 --- a/smoke-test/spring-boot-smoke-test-war/src/test/java/smoketest/war/WarApplicationResourceTests.java +++ b/smoke-test/spring-boot-smoke-test-war/src/test/java/smoketest/war/WarApplicationResourceTests.java @@ -16,6 +16,7 @@ package smoketest.war; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Value; @@ -29,7 +30,7 @@ class WarApplicationResourceTests { // gh-6371 @Value("${demo.string.value}") - private String demoStringValue; + private @Nullable String demoStringValue; @Test void contextLoads() {