From 862adc8f4122672353a5f6a26ec774d311b27e99 Mon Sep 17 00:00:00 2001 From: raj44444 Date: Wed, 24 Dec 2025 06:05:22 +0530 Subject: [PATCH 1/4] Upgrade to Java 21 and Spring Boot 2.7.12 --- pom.xml | 15 ++++++++++++--- rewrite.yml | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 rewrite.yml diff --git a/pom.xml b/pom.xml index 323aef3..a111a21 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.3.5.RELEASE + 2.7.12 @@ -18,9 +18,9 @@ UTF-8 UTF-8 - 1.8 + 21 9.0.43 - 5.4.4 + 5.7.8 @@ -54,6 +54,15 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 21 + + org.springframework.boot spring-boot-maven-plugin diff --git a/rewrite.yml b/rewrite.yml new file mode 100644 index 0000000..a18721a --- /dev/null +++ b/rewrite.yml @@ -0,0 +1,6 @@ +type: specs.openrewrite.org/v1beta/recipe +name: com.devsecops.upgrade-java-21 +displayName: Upgrade to Java 21 and Spring Boot 2.7 +recipeList: + - org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_7 + - org.openrewrite.java.migrate.UpgradeToJava21 From 99add6e08c3743a2a489a3674654a7dac6cca34a Mon Sep 17 00:00:00 2001 From: raj44444 Date: Wed, 24 Dec 2025 06:06:40 +0530 Subject: [PATCH 2/4] Convert tests to JUnit 5 (NumericApplicationTests) --- src/test/java/com/devsecops/NumericApplicationTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/devsecops/NumericApplicationTests.java b/src/test/java/com/devsecops/NumericApplicationTests.java index 71397a2..53e391a 100644 --- a/src/test/java/com/devsecops/NumericApplicationTests.java +++ b/src/test/java/com/devsecops/NumericApplicationTests.java @@ -1,7 +1,7 @@ package com.devsecops; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; @@ -22,11 +22,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; //import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.junit4.SpringRunner; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc public class NumericApplicationTests { From 5485a5e9dd82be11cc1527434ec2fd2f2e7825dc Mon Sep 17 00:00:00 2001 From: raj44444 Date: Wed, 24 Dec 2025 06:10:49 +0530 Subject: [PATCH 3/4] Upgrade springdoc-openapi-ui to 1.6.14 to fix bean creation issues --- pom.xml | 2 +- src/test/java/com/devsecops/NumericApplicationTests.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index a111a21..6038156 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ org.springdoc springdoc-openapi-ui - 1.2.30 + 1.6.14 diff --git a/src/test/java/com/devsecops/NumericApplicationTests.java b/src/test/java/com/devsecops/NumericApplicationTests.java index 53e391a..5458027 100644 --- a/src/test/java/com/devsecops/NumericApplicationTests.java +++ b/src/test/java/com/devsecops/NumericApplicationTests.java @@ -1,6 +1,5 @@ package com.devsecops; - import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -45,14 +44,11 @@ public void greaterThanFiftyMessage() throws Exception { this.mockMvc.perform(get("/compare/51")).andDo(print()).andExpect(status().isOk()) .andExpect(content().string("Greater than 50")); } - - -@Test + @Test public void welcomeMessage() throws Exception { this.mockMvc.perform(get("/")).andDo(print()).andExpect(status().isOk()) .andExpect(content().string("Kubernetes DevSecOps")); } - } \ No newline at end of file From 7ddc4cfb325b7c2c7f6990b0b033b07754e19e44 Mon Sep 17 00:00:00 2001 From: raj44444 Date: Wed, 24 Dec 2025 06:19:03 +0530 Subject: [PATCH 4/4] Code migration completed: Upgrade to Java 21 and Spring Boot 2.7.12 --- rewrite.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 rewrite.yml diff --git a/rewrite.yml b/rewrite.yml deleted file mode 100644 index a18721a..0000000 --- a/rewrite.yml +++ /dev/null @@ -1,6 +0,0 @@ -type: specs.openrewrite.org/v1beta/recipe -name: com.devsecops.upgrade-java-21 -displayName: Upgrade to Java 21 and Spring Boot 2.7 -recipeList: - - org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_7 - - org.openrewrite.java.migrate.UpgradeToJava21