openrewrite / openrewrite/rewrite-spring

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

Open
#525 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/epic recipe
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the migration checklist in the issue and its linked Baeldung outline, then examine the requested changes to org.springframework dependencies, beans.xml, applicationContext.xml, application.yml, packaging, and configuration classes. Done means the recipe covers an agreed subset or all of the listed Spring Framework-to-Spring Boot transformations; the issue does not name tests or existing entry points.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.