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

Recipe to migrate @RequestMapping over a FeignClient interface to @FeignClient path attribute #661

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

wapkch
Copy link
Contributor

@wapkch wapkch commented Jan 9, 2025

What's changed?

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@timtebeek timtebeek self-requested a review January 9, 2025 09:57
@timtebeek timtebeek added the recipe Recipe requested label Jan 9, 2025
@timtebeek
Copy link
Contributor

Thanks a lot for the help here @wapkch ! Great to see these attributes moved when upgrading. :)

@MBoegers
Copy link
Contributor

MBoegers commented Jan 9, 2025

Hi @wapkch thanks for providing! If you want to get rid of the github-actions comments, you can utilize OpenRewrite with the OpenRewrite best practices recipe.

@MBoegers
Copy link
Contributor

MBoegers commented Jan 9, 2025

Do you know you can use OpenRewrite reicpes inside imperative recipes?
I think in your case, you could use the org.openrewrite.java.AddOrUpdateAnnotationAttribute recipe to add the post attribute to the @FeignClient annotation.

cd = new AddOrUpdateAnnotationAttribute(FEIGN_CLIENT, "path", pathValueFromRequestMapping, true, false)
    .getVisitor().visitClassDeclaration(cd, ctx);
cd = new RemoveAnnotation(REQUEST_MAPPING)
    .getVisitor().visitClassDeclaration(cd, ctx);

@MBoegers
Copy link
Contributor

Thanks @wapkch, for the fixes and congrats to your first merged contribution 🎆

@MBoegers MBoegers merged commit b121b80 into openrewrite:main Jan 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe requested
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Recipe to migrate @RequestMapping over a FeignClient interface to @FeignClient path attribute
3 participants