bgjug / jprime

jprime conf site using spring
8 stars 22 forks source link

Spring Boot 3.x #239

Closed timtebeek closed 11 months ago

timtebeek commented 1 year ago

Via: https://docs.openrewrite.org/recipes/java/spring/boot3/upgradespringboot_3_0

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE \
  -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_0
doychin commented 1 year ago

We are still using Java 11. Text blocks will not work.

timtebeek commented 1 year ago

We are still using Java 11. Text blocks will not work.

In that case you're better off first looking at https://github.com/bgjug/jprime/pull/238, as Spring Boot 3 requires Java 17.

Here are instructions if you would want to first, and separately, like to upgrade to Java 17: https://docs.openrewrite.org/running-recipes/popular-recipe-guides/migrate-to-java-17 https://docs.openrewrite.org/recipes/java/migrate/upgradetojava17

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE \
  -Drewrite.activeRecipes=org.openrewrite.java.migrate.UpgradeToJava17
timtebeek commented 1 year ago

With OSS support for Spring Boot 2.7 expiring a month from now, it might be good to reconsider a move to Spring Boot 3.1 & Java 17.

timtebeek commented 11 months ago

Seeing the conflicts in this PR I think it's best to close this one; it was created in a mostly automated fashion; here's a quick guide if you're looking to migrate still.

Leap to Spring Boot 3.1

You will want to run the Migrate Spring Boot 3.1 recipe, which runs you through all the steps of migrating to Spring Boot 3.1, no matter what version you're coming from.

Migrate in steps

If you'd rather migrate in steps, you can also run recipes individually. This can be helpful if you'd like to review and build confidence in the changes, or need to troubleshoot a particular aspect.

As you can see in the Migrate Spring Boot 3.1 recipe, that first takes you to Spring Boot 3.0, which first takes you to Spring Boot 2.7, which first takes you to Spring Boot 2.6, ... You can run any of these intermediate recipes, to pick up the changes up to that point.

You can also pick out specific migrations, for as much as you aren't up-to-date already, such as

Best practices after you migrate

After you've migrated to Spring Boot 3.1, you might want to consider some of the following best practices:

You might even want to run some of these recipes periodically, to keep your projects up-to-date continuously.

Helpful resources

Here's a number of links that might be helpful in case you encounter edge cases not yet covered:

doychin commented 11 months ago

Thanks for the instructions @timtebeek . I plan to do this migration in the comming weeks.