From 476b10bcb65b7937a25e08485b8970d35dfb98f0 Mon Sep 17 00:00:00 2001 From: Robin de Silva Jayasinghe Date: Thu, 9 Jul 2026 10:29:54 +0200 Subject: [PATCH] =?UTF-8?q?Add=20Spring=20Boot=204=20test=20code=20migrati?= =?UTF-8?q?on=20section=20to=20CAP=20Java=204=E2=86=925=20guide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/migration.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/java/migration.md b/java/migration.md index e2597ed29..fb08289ef 100644 --- a/java/migration.md +++ b/java/migration.md @@ -69,6 +69,14 @@ CAP Java 5 uses Spring Boot 4 and Spring Security 7 as the underlying framework. You must also upgrade the [BTP Security Library](https://github.com/SAP/cloud-security-services-integration-library) to version 4.0.0 or later. +#### Test Code Changes { #spring-boot-4-test-code } + +While regular CAP Java application code rarely touches Spring Boot APIs directly, test code typically does. Spring Boot 4 introduces a new module structure for its testing support, which results in package name changes that can break existing test classes. Common examples are the test slice annotations (such as `@AutoConfigureMockMvc`, `@WebMvcTest`, or `@DataJpaTest`) that were relocated as part of this restructuring. + +Refer to the [Test Code section of the Spring Boot 4.0 Migration Guide](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#test-code) for the complete list of affected packages and classes. + +These package renames are already covered by the [OpenRewrite community recipes](https://docs.openrewrite.org/recipes/java/spring/boot4) for Spring Boot 4, so you can apply them automatically together with the [CAP Java OpenRewrite migrations](#automatic-cap-java-migrations-with-openrewrite) above. The same applies to the commercial recipes offered by the [Moderne platform](https://www.moderne.ai/). + ### Minimum Versions CAP Java 5.0 increased some minimum required versions: