This page describes how the Spring Boot project enforces code quality and how its test suite is organized across multiple layers. It covers the shared test support modules, the Gradle plugins that configure test execution and static analysis, and how all of these are applied consistently to every subproject through the convention plugin system.
For the detailed mechanics of how JavaConventions configures test tasks, see Test Configuration and Execution. For Checkstyle rules, Kotlin conventions, and Detekt configuration details, see Checkstyle and Kotlin Conventions. For the smoke test and system test suites specifically, see Smoke Tests and System Tests.
Quality in the Spring Boot build is enforced at two levels:
org.springframework.boot.conventions plugin automatically gets Checkstyle, Spring Java Format, prohibited-dependency checks, test retry configuration, and nullability enforcement.Sources: settings.gradle63-66 buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java42-58
The repository declares test-related subprojects in four separate groups inside settings.gradle.
| Group | Purpose | Example subprojects |
|---|---|---|
test-support: | Shared utilities used by tests in other modules | spring-boot-test-support, spring-boot-docker-test-support, spring-boot-gradle-test-support |
core:spring-boot-test | The @SpringBootTest annotation and related infrastructure | spring-boot-test, spring-boot-test-autoconfigure |
smoke-test: | Full-application tests for specific feature combinations (~80 projects) | spring-boot-smoke-test-web-secure, spring-boot-smoke-test-actuator |
integration-test: | Cross-module integration verification | spring-boot-integration-tests, spring-boot-loader-integration-tests |
system-test: | End-to-end tests against built OCI images or deployments | spring-boot-image-system-tests, spring-boot-deployment-system-tests |
Sources: settings.gradle63-66 settings.gradle384-490
Test layer relationships
Sources: settings.gradle63-66 settings.gradle384-490 buildSrc/build.gradle134-172
The ConventionsPlugin is the single entry point that wires all quality enforcement. When applied to a subproject, it delegates to several subordinate convention classes.
How quality conventions are applied to each subproject
Sources: buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java42-58 buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java148-163 buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java59-113
All Test tasks across every subproject receive a uniform configuration from JavaConventions.configureTestConventions.
| Setting | Value | Source |
|---|---|---|
| Test framework | JUnit Platform (useJUnitPlatform()) | JavaConventions.java209 |
| Maximum heap | 1536M | JavaConventions.java210 |
| Ordering | Tests run after all Checkstyle and CheckFormat tasks | JavaConventions.java211-212 |
| Retries on CI | 3 (when CI=true env var is set) | JavaConventions.java221-227 |
| Retries locally | 0 | JavaConventions.java221-227 |
| Fail on pass-after-retry | false | JavaConventions.java225 |
| Predictive test selection | Enabled when ENABLE_PREDICTIVE_TEST_SELECTION=true | JavaConventions.java233-243 |
| Launcher dependency | org.junit.platform:junit-platform-launcher added to testRuntimeOnly | JavaConventions.java216-218 |
The retry and predictive selection features use the Develocity Gradle plugin's DevelocityTestConfiguration extension. The isCi() check reads the standard CI environment variable that GitHub Actions sets automatically.
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java207-243
JavaConventions.configureSpringJavaFormat applies two complementary tools:
SpringJavaFormatPlugin — provides checkFormat and format tasks. All Format tasks use UTF-8 encoding.CheckstylePlugin — uses rules from config/checkstyle/. The tool version is read from the checkstyleToolVersion Gradle property. Two dependencies are added to the checkstyle configuration: com.puppycrawl.tools:checkstyle and io.spring.javaformat:spring-javaformat-checkstyle.Both the CheckFormat and Checkstyle tasks exclude generated sources (any path containing /generated/sources/ or /generated-source/).
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java289-313
KotlinConventions.configureDetekt applies DetektPlugin to every Kotlin-enabled subproject. The configuration file is config/detekt/config.yml.
Active rules in config/detekt/config.yml:
| Rule | Category |
|---|---|
MatchingDeclarationName | naming |
MaxLineLength | style |
NewLineAtEndOfFile | style |
UnusedImport | style |
WildcardImport | style |
The global setting warningsAsErrors: true means any Detekt finding fails the build.
Sources: buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java105-112 config/detekt/config.yml1-26
KotlinConventions configures KotlinCompile tasks with:
apiVersion and languageVersion set to KOTLIN_2_2jvmTarget set to JVM_17allWarningsAsErrors = true-Xsuppress-version-warnings, -Xannotation-default-target=param-propertySources: buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java67-75
JavaConventions.configureJavaConventions adds these flags to every JavaCompile task:
-parameters -Werror -Xlint:unchecked -Xlint:deprecation -Xlint:rawtypes -Xlint:varargs
-Werror promotes all compiler warnings to errors.
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java263-273
JavaConventions.configureProhibitedDependencyChecks registers a CheckClasspathForProhibitedDependencies task for both the compile and runtime classpath of every source set. These tasks are wired into the check lifecycle task.
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java343-363
For the main source set of each module, two additional tasks are registered and wired into check:
checkAotFactories — verifies META-INF/spring/aot.factories via CheckAotFactoriescheckSpringFactories — verifies META-INF/spring.factories via CheckSpringFactoriesSources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java365-385
JavaConventions.configureNullability applies NullabilityPlugin, which configures NullAway and ErrorProne for null-safety checking. Version pins for both tools are read from nullAwayVersion and errorProneVersion Gradle properties.
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java387-398
ArchitecturePlugin is applied by JavaConventions. It performs package-level architecture validation using ArchUnit (declared as a buildSrc dependency at version 1.4.1).
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java150 buildSrc/build.gradle51
The buildSrc build registers several test-category plugins in gradlePlugin {}.
Test-related Gradle plugins registered in buildSrc
Sources: buildSrc/build.gradle133-172
SystemTestPlugin creates a systemTest source set and a systemTest Test task. Key behaviors:
systemTest task runs after the test task (shouldRunAfter(JavaPlugin.TEST_TASK_NAME))CI=true), outputs are never considered up-to-date (upToDateWhen(NEVER)) and caching is disabledorg.junit.platform:junit-platform-launcher is added to systemTestRuntimeOnlysystemTest runtime classpath is added to the Eclipse classpathSources: buildSrc/src/main/java/org/springframework/boot/build/test/SystemTestPlugin.java54-99
Three dedicated test-support subprojects provide utilities consumed by other modules' tests. They are declared in the test-support: group in settings.gradle.
| Subproject | Purpose |
|---|---|
spring-boot-test-support | General test utilities shared across all modules |
spring-boot-docker-test-support | Utilities for tests that require a Docker daemon (used by DockerTestPlugin) |
spring-boot-gradle-test-support | Gradle test kit helpers; used by the Gradle plugin tests and image system tests |
Sources: settings.gradle63-65
Quality enforcement flow for a single subproject
Sources: buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java148-163 buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java59-113 buildSrc/src/main/java/org/springframework/boot/build/ConventionsPlugin.java42-58
Refresh this wiki