openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
237 stars 64 forks source link

Add recipe to migrate projects from Spring Framework to using Spring Boot #525

Open FieteO opened 1 month ago

FieteO commented 1 month ago

What problem are you trying to solve?

I have an old application that is not using spring-boot yet, but rather uses the spring framework. I'd like to migrate it to spring-boot since that is easier to work with and seems more future-proof.

What precondition(s) should be checked before applying this recipe?

That dependencies from the org.springframework group are present (i.e org.springframework.spring-core, org.springframework.spring-web,...)

Describe the situation before applying the recipe

Describe the situation after applying the recipe

A list of steps with links to documentation

Roughly based upon outline in https://www.baeldung.com/spring-boot-migration

Have you considered any alternatives or workarounds?

No

Are you interested in contributing this recipe to OpenRewrite?

Generally yes, but I wouldn't start with such a (likely quite complex) endeavour.

timtebeek commented 1 month ago

Hi @FieteO ; thanks for the suggestion! It's come up a few times internally as well. Right now I'd say we have a lot of recipes and building blocks that might assist such a migration, but none explicitly that convert towards Spring Boot.

As with other migration recipes we've done in the past I find it works best if we break the task down into smaller steps that can individually be contributed. You've called out dependencies already as a step that would be relatively straightforward with the Add/Change/RemoveDependency building blocks that we offer. Perhaps there's more we can do to break this down and to offer a start relatively soon, that can then be expanded upon. I find a GitHub task list might work best; no immediate need for separate issues; we can pick those up in pull requests.

FieteO commented 1 month ago

That's good to hear! Do you need any further input from my side?

timtebeek commented 1 month ago

You'll probably have a better idea of what makes up a current Spring Framework application, and what steps you see when you migrate one to Spring Boot. If you could help document the steps needed that would be great.

FieteO commented 1 month ago

I will see what I can do. Though I actually have no history of working with a springframework based service, it's just inherited. You suggested to document steps in a GitHub task list. Could you provide some link for that, since I have not worked with them yet...

timtebeek commented 1 month ago

Sure; I've updated your post above to include a start to such a list; we can expand that of course, and cross them off once implemented. Some of them should be fairly straightforward, although it might be hard to do a complete automated migration. I think that's valid enough to have a recipe help you on your way though, so no need to be exhaustive for a one time migration.