Skip to content

Upgrade Support

Martin Lippert edited this page Dec 7, 2022 · 1 revision

Version Upgrade Support (new in 4.17.0 / 1.41.0)

The new version of the Spring Tools 4.17.0 (and the corresponding extensions for VSCode in version 1.41.0) introduces support when upgrading to newer versions of Spring Boot.

Upgrading to newer versions of Spring Boot usually means to walk through the release announcements of Spring Boot and possible migration guides and change your project accordingly (e.g. updating to changed property names). The new support for upgrading projects in the Spring Tools now provide automation for those changes that can be automated, in order to make it easier for you to adopt newer versions of Spring Boot.

Upgrade to newer patch versions

The newly introduced validations for Spring Boot versions come with corresponding quick fixes to make the necessary changes for you automatically. In the case of newer patch versions, this will update the version of the Spring Boot parent pom in your pom.xml file for you, but nothing else.

You can invoke the quick fix either from the marker in the problems view directly or via the marker in the pom.xml file.

Upgrade to newer minor or major versions

Validation markers for newer minor or major versions of Spring Boot also come with corresponding quick fixes. But those quick fixes do not only update the version of Spring Boot in the pom.xml file. Instead, the execute a full upgrade recipe from OpenRewrite in order to change as much as possible automatically, including updating changed property key names, polish code, switch the Java level to 17 (in case of an upgrade to Spring Boot 3) and more.

Execute full or partial upgrade recipes on demand

In addition to the quick fixes that you get on validation markers for newer versions of Spring Boot, the tools also offer you a menu item to execute those upgrades on demand and with more fine-grained control over what exactly is going to happen. You can find the menu item from the command palette (in VSCode) or in the context-menu on a project (in Eclipse or STS).

The menu item will offer you a dialog or quick picks to see exactly what is contained in each upgrade recipe, including detailed descriptions of each step. In addition to that, you can enable/disable specific steps of a recipe. In case, for example, you would like to exclude the automatic change from javax... to jakarta... packages when upgrading to Spring Boot 3, you can deactivate that individual step from the overall upgrade recipe and execute all the other steps.

OpenRewrite

Behind the scenes, the Spring Tools leverage OpenRewrite (https://github.com/openrewrite), an open-source project that aims at automating code changes at a broad scale - especially the rewrite-spring module (https://github.com/openrewrite/rewrite-spring) that contains all the Spring-related recipes.

Contributions

The initial set of recipes and automation that the Spring Tools ship are not meant to be complete and do not cover everything. In case you are missing a specific piece or have ideas/suggestions for improvements, please file an issue at https://github.com/spring-projects/sts4/issues

Clone this wiki locally