Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
9 tasks
FieteO opened this issue May 10, 2024 · 5 comments
Open
9 tasks
Labels
kind/epic Big initiative recipe Recipe requested

Comments

@FieteO
Copy link
Contributor

FieteO commented May 10, 2024

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

  • org.springframework dependencies
  • beans.xml

Describe the situation after applying the recipe

  • org.springframework.boot dependencies
  • application.yml and @Configuration files

A list of steps with links to documentation

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

  • Replace explicit Spring Framework dependencies with corresponding Spring Boot starter dependencies
  • Change packaging from war to jar
  • Add embedded web server dependency
  • Replace simple <bean>s with annotations on corresponding classes
  • Add a @SpringBootApplication annotated main Application class
  • Add @ImportResource("applicationContext.xml") for remaining xml configuration
  • Migrate resource files to standardized paths, or customize spring.resources.static-locations property
  • Remove explicit WebApplicationInitializer and @EnableWebMvc classes
  • ...

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 timtebeek added the recipe Recipe requested label May 10, 2024
@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite May 10, 2024
@timtebeek timtebeek changed the title Add migrate spring-framework to spring-boot recipe Add recipe to migrate projects from Spring Framework to using Spring Boot May 10, 2024
@timtebeek
Copy link
Contributor

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.

@timtebeek timtebeek added the kind/epic Big initiative label May 10, 2024
@FieteO
Copy link
Contributor Author

FieteO commented May 10, 2024

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

@timtebeek
Copy link
Contributor

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
Copy link
Contributor Author

FieteO commented May 10, 2024

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/epic Big initiative recipe Recipe requested
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants