-
Notifications
You must be signed in to change notification settings - Fork 86
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
Spring 2.7: Recipe to replace getById with getReferenceById #515
Comments
Thanks for the report @lucashan ! Is this something you'd want to contribute given that you've already provided a good start with the |
Sounds good, I can make the contribution! Which test class should I be including the unit tests to @timtebeek ? |
Thanks a lot! I think we can start a new data package here with a new test class for this recipe: We likely need to add the spring-data dependency to this block of dependencies: rewrite-spring/build.gradle.kts Lines 196 to 207 in 5b5c130
Then the method pattern should match the getById method as defined here. Let me know if you'd like any help with setting up that test; a draft PR would let me help you most easily there. |
Sounds good! Do you mind creating a branch that I can use for the PR? I don't have write access for this issue. |
Feel free to create a fork of this project and a branch there. Then you can open a draft PR that I can edit. I don't think that works the other way around when I first create a branch, as there's no way for me to them easily give you limited access. |
Thank you, I had reduced bandwidth today but will work on this tomorrow! I've also created another recipe issue, apologies in advanced if it was created in the wrong OpenRewrite repository. |
Here's the draft PR! unfortunately I have not been able to figure out how to properly write the unit test/update the build.gradle.kts. Would it be possible to take a look at the PR? #518 |
Awesome thanks! I'll try to fit in writing tests for this case on your PR! :) |
Fixed in: #518 Thanks again! |
What problem are you trying to solve?
As of Springboot v2.7, both
getOne()
andgetById()
methods have been deprecated forJpaRepository
. The documentation states that these deprecated methods should be replaced withgetReferenceById(ID)
.We should include this recipe for Spring 2.7, for example:
Describe the situation before applying the recipe
Describe the situation after applying the recipe
Have you considered any alternatives or workarounds?
N/A
Are you interested in contributing this recipe to OpenRewrite?
The text was updated successfully, but these errors were encountered: