spring-bootjava-8maven-3java-21openrewrite

sample example of java upgrade from 8 to 21 using open rewrite


I have a springboot application with version 2.x and using java 8, I would like to upgrade the java VERSION TO 21 and spring boot version to 3.x, My question is which is the easiest way to upgrade these frameworks. and how to upgrade using open rewrite using maven


Solution

  • This page shows you how to upgrade to spring boot 3.3 and Java 21: https://docs.openrewrite.org/recipes/java/spring/boot3/springboot3bestpractices

    Under usage there is a command you can copy for Maven that should run as is:

    mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.SpringBoot3BestPractices -Drewrite.exportDatatables=true
    

    Hope that helps!