rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Migrate HATEOS to v1.0 (Spring boot >= 2.2.0)

Open mbucc opened this issue 2 years ago • 2 comments

What problem are you trying to solve?

Refactor old SpringBoot HATEOS code so it compiles.

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

SpringBoot version < 2.2.0

Describe the situation before applying the recipe

Code uses one of ResourceSupport/Resource/Resources/PagedResources classes.

Describe the situation after applying the recipe

Old classes have been mapped to new ones.

See https://docs.spring.io/spring-hateoas/docs/current/reference/html/#migrate-to-1.0.changes.representation-models.

Have you considered any alternatives or workarounds?

No.

Any additional context

Spring team provided a migration script.

https://github.com/spring-projects/spring-hateoas/blob/main/etc/migrate-to-1.0.sh

Are you interested in contributing this recipe to OpenRewrite?

Sure.

mbucc avatar Aug 05 '23 12:08 mbucc

Note from @timtebeek in Slack channel:

1 hour ago you can probably compile most of that migration by adding core recipes from the marketplace to the recipe builder

mbucc avatar Aug 05 '23 12:08 mbucc

Thanks for logging this as an issue @mbucc ! Any implementation I'd expect to be similar to how we support spring cloud and spring batch migrations currently, as mostly yaml recipes composed together, with some tests added to ensure it all works. Here's an example for Spring Cloud: https://github.com/openrewrite/rewrite-spring/blob/main/src/main/resources/META-INF/rewrite/spring-cloud-2022.yml

Let me know if you'd need any help with an implementation! The testing setup would likely require the addition of the dependency and then running ./gradlew downloadRecipeDependencies, as per our documentation on using multiple versions, which we heavily use in rewrite-spring. Other than that it should be straightforward to get started on a draft PR; that way we're able to help out if you get stuck in any way.

timtebeek avatar Aug 07 '23 09:08 timtebeek