upgrade to Spring Boot 4.2.1
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
**Status:**
|
||||
- proposed: 2026-06-09
|
||||
- accepted: -
|
||||
- accepted: 2026-06-09
|
||||
- rejected: -
|
||||
- superseded: -
|
||||
|
||||
**Decision [proposed]:** Gradle 8.14 — minimum required by Spring Boot 4.0; Gradle 9 deferred until openapi-generator and ktlint-gradle confirm compatibility.
|
||||
**Decision [accepted]:** Gradle 8.14.5 — minimum required by Spring Boot 4.0; Gradle 9 deferred until openapi-generator and ktlint-gradle confirm compatibility.
|
||||
|
||||
## Context and Problem Statement
|
||||
|
||||
@@ -41,7 +41,7 @@ It has a direct dependency chain:
|
||||
- Plugin ecosystem readiness varies: the
|
||||
[openapi-generator Gradle plugin](https://github.com/OpenAPITools/openapi-generator/issues/22084)
|
||||
has a known Gradle 9 issue in its generated build files, and
|
||||
[ktlint-gradle 12.1.1](https://github.com/JLLeitschuh/ktlint-gradle) Gradle 9 support
|
||||
[ktlint-gradle 14.2.0](https://github.com/JLLeitschuh/ktlint-gradle) Gradle 9 support
|
||||
needs verification.
|
||||
- The [`io.spring.dependency-management` plugin](https://github.com/spring-gradle-plugins/dependency-management-plugin)
|
||||
used to resolve the Spring BOM has known friction with Gradle 9
|
||||
@@ -56,9 +56,9 @@ current 8.8 is necessary regardless of whether Gradle 9 is chosen.
|
||||
* Gradle 8.14 (minimum for Spring Boot 4.0)
|
||||
* Gradle 9.x
|
||||
|
||||
### [Gradle 8.x](https://docs.gradle.org/8.8/release-notes.html)
|
||||
### [Gradle 8.x](https://docs.gradle.org/8.14.5/release-notes.html)
|
||||
|
||||
The currently configured series (wrapper at 8.8, to be bumped to 8.14+ for Spring Boot 4.0).
|
||||
The currently configured series (wrapper at 8.14.5, upgraded from 8.8 as part of the Spring Boot 4.0 migration).
|
||||
|
||||
#### Advantages
|
||||
|
||||
@@ -91,7 +91,7 @@ The current major release (9.5.1 as of May 2026), officially supported alongside
|
||||
- [openapi-generator-gradle-plugin](https://github.com/OpenAPITools/openapi-generator/issues/22084)
|
||||
has a known Gradle 9 issue in generated `build.gradle` files; impact on the spec-first
|
||||
code generation task specifically needs verification.
|
||||
- [ktlint-gradle 12.1.1](https://github.com/JLLeitschuh/ktlint-gradle) Gradle 9 support
|
||||
- [ktlint-gradle 14.2.0](https://github.com/JLLeitschuh/ktlint-gradle) Gradle 9 support
|
||||
needs verification.
|
||||
- Configuration Cache mandatory means any currently uncached plugin will break the build
|
||||
until updated, complicating initial setup.
|
||||
@@ -106,7 +106,7 @@ The main reasons:
|
||||
- Gradle 9 is technically compatible with Spring Boot 4.0, but the mandatory Configuration Cache
|
||||
creates unacceptable risk until the openapi-generator-gradle-plugin Gradle 9 compatibility
|
||||
is confirmed (see [issue #22084](https://github.com/OpenAPITools/openapi-generator/issues/22084)).
|
||||
- ktlint-gradle 12.1.1 Gradle 9 support is unverified; a formatter breaking the build on day
|
||||
- ktlint-gradle 14.2.0 Gradle 9 support is unverified; a formatter breaking the build on day
|
||||
one is a poor start.
|
||||
|
||||
Upgrade trigger: revisit Gradle 9 once openapi-generator and ktlint-gradle confirm support.
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
**Status:**
|
||||
- proposed: 2026-06-09
|
||||
- accepted: -
|
||||
- accepted: 2026-06-09
|
||||
- rejected: -
|
||||
- superseded: -
|
||||
|
||||
**Decision [proposed]:** Spring Boot 4.0 — only actively-supported version; springmockk workaround via @TestConfiguration until a compatible release is published.
|
||||
**Decision [accepted]:** Spring Boot 4.0.6 — only actively-supported version; springmockk 5.0.1 provides @MockkBean for Spring Boot 4.0.
|
||||
|
||||
## Context and Problem Statement
|
||||
|
||||
@@ -34,12 +34,12 @@ Spring Boot 4.0 moves to Spring Framework 7 and Jakarta EE 11.
|
||||
|
||||
The key ecosystem dependencies and their Spring Boot 4.0 compatibility status:
|
||||
|
||||
| Dependency | Role | Spring Boot 4.0 status |
|
||||
|---|---|---|
|
||||
| [picocli-spring-boot-starter](https://picocli.info/) | CLI wiring | Untested; last documented target is Spring Boot 3.1. The integration is minimal (one `IFactory` bean), so it likely works in practice. |
|
||||
| [springmockk](https://github.com/Ninja-Squad/springmockk) | `@MockkBean` in tests | **Incompatible** — confirmed Spring Boot 3.x only. |
|
||||
| [kotest-extensions-spring](https://github.com/kotest/kotest-extensions-spring) | Kotest + `@SpringBootTest` | Compatibility unconfirmed. |
|
||||
| [wiremock-spring-boot](https://wiremock.org/docs/spring-boot/) | HTTP stubbing in tests | **Compatible** — Spring Boot 4.0 explicitly supported since January 2026. |
|
||||
| Dependency | Version | Role | Spring Boot 4.0 status |
|
||||
|---|---|---|---|
|
||||
| [picocli-spring-boot-starter](https://picocli.info/) | 4.7.6 | CLI wiring | **Compatible** — `ApplicationContextTest` confirms context wiring works. |
|
||||
| [springmockk](https://github.com/Ninja-Squad/springmockk) | 5.0.1 | `@MockkBean` in tests | **Compatible** — 5.x released specifically for Spring Boot 4.0; `@MockkBean` verified. |
|
||||
| [kotest-extensions-spring](https://github.com/kotest/kotest-extensions-spring) | 6.1.5 | Kotest + `@SpringBootTest` | **Compatible** — 6.x (new groupId `io.kotest`) required; config moved to `io.kotest.provided.ProjectConfig`. |
|
||||
| [wiremock-spring-boot](https://wiremock.org/docs/spring-boot/) | 4.2.1 | HTTP stubbing in tests | **Compatible** — Spring Boot 4.0 explicitly supported since January 2026. |
|
||||
|
||||
## Considered Options
|
||||
|
||||
@@ -76,12 +76,9 @@ The current and only actively-supported major release.
|
||||
|
||||
#### Disadvantages
|
||||
|
||||
- **springmockk is incompatible.** The `@MockkBean` / `@SpykBean` annotations are not available.
|
||||
This matters in particular for `@WebMvcTest` (controller error-behaviour) and
|
||||
`@DataJpaTest`-adjacent tests where collaborators need to be mocked in the Spring context.
|
||||
The workaround is to register MockK mocks as Spring beans via `@TestConfiguration`,
|
||||
which preserves full MockK syntax (`every { }`, `verify { }`) at the cost of one
|
||||
inner configuration class per test file and an explicit `clearMocks()` call in `beforeEach`:
|
||||
- **springmockk 5.x is required.** Version 4.x is Spring Boot 3.x only. Version 5.0.1 adds
|
||||
Spring Boot 4.0 support; `@MockkBean` / `@SpykBean` work as expected.
|
||||
As an alternative, register MockK mocks via `@TestConfiguration` without the springmockk dependency:
|
||||
```kotlin
|
||||
@WebMvcTest(SomeController::class)
|
||||
@Import(SomeControllerTest.Mocks::class)
|
||||
@@ -93,17 +90,12 @@ The current and only actively-supported major release.
|
||||
@Autowired lateinit var someService: SomeService
|
||||
init {
|
||||
beforeEach { clearMocks(someService) }
|
||||
// full MockK syntax available
|
||||
}
|
||||
}
|
||||
```
|
||||
This is more verbose than `@MockkBean` but avoids mixing Mockito and MockK.
|
||||
Revisit once springmockk publishes a Spring Boot 4.0-compatible release.
|
||||
- **picocli-spring-boot-starter is untested against Spring Boot 4.0.**
|
||||
The risk is low (the auto-configuration is a single `IFactory` bean with no framework-version-specific API),
|
||||
but it cannot be assumed safe until verified by a running context test.
|
||||
- **kotest-extensions-spring** compatibility needs verification before the first
|
||||
`@SpringBootTest` test is written.
|
||||
- **picocli-spring-boot-starter** context wiring confirmed via `ApplicationContextTest`.
|
||||
- **kotest-extensions-spring 6.x** (groupId `io.kotest`) is required for Spring Boot 4.0.
|
||||
The project config must be placed at `io.kotest.provided.ProjectConfig` (Kotest 6 discovery requirement).
|
||||
- Relatively new GA; fewer community examples for the 4.0 generation.
|
||||
|
||||
## Decision Outcome
|
||||
@@ -124,9 +116,4 @@ The main reasons:
|
||||
- kotest-extensions-spring compatibility must be verified before the
|
||||
first `@SpringBootTest` test is written.
|
||||
|
||||
Open items before the code is upgraded:
|
||||
1. Bump Spring Boot to 4.0.6 and verify `ApplicationContextTest` still passes.
|
||||
2. Confirm picocli-spring-boot-starter works under the new context.
|
||||
3. Confirm kotest-extensions-spring works with Spring Boot 4.0.
|
||||
4. Replace `@MockkBean` usages with the `@TestConfiguration` + `mockk()` pattern
|
||||
until springmockk publishes a compatible release.
|
||||
All ecosystem blockers are resolved. The codebase runs Spring Boot 4.0.6.
|
||||
|
||||
Reference in New Issue
Block a user