-
Notifications
You must be signed in to change notification settings - Fork 82
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
Replace @Required on setters with @Autowired #612
Replace @Required on setters with @Autowired #612
Conversation
src/main/java/org/openrewrite/java/spring/RequiredFieldIntoConstructorParameter.java
Outdated
Show resolved
Hide resolved
...ringBoot_2_1/java/org/openrewrite/java/spring/RequiredFieldIntoConstructorParameterTest.java
Outdated
Show resolved
Hide resolved
...ringBoot_2_1/java/org/openrewrite/java/spring/RequiredFieldIntoConstructorParameterTest.java
Outdated
Show resolved
Hide resolved
...ringBoot_2_1/java/org/openrewrite/java/spring/RequiredFieldIntoConstructorParameterTest.java
Outdated
Show resolved
Hide resolved
…structorParameter.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…quiredFieldIntoConstructorParameterTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…quiredFieldIntoConstructorParameterTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…quiredFieldIntoConstructorParameterTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/main/java/org/openrewrite/java/spring/ReplaceRequiredAnnotationOnSetterWithAutowired.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/ReplaceRequiredAnnotationOnSetterWithAutowired.java
Outdated
Show resolved
Hide resolved
61138ae
to
55cfa44
Compare
|
||
import java.util.Comparator; | ||
|
||
public class ReplaceRequiredAnnotationOnSetterWithAutowired extends Recipe { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a recipe would this also be possible with a declarative recipe ChangeType
? Or are there edge cases that won't cover?
Whenever possible try to do declaratively what we can; that helps reduce what we need to maintain going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: your recipe is not yet hooked into any of the Spring Boot migrations, meaning folks would have to run this one manually; please hook it into the appropriate place in a larger migration.
What's changed?
The deprecated @Required annotation can be applied to setters of field, to ensure a bean is injected. However, the annotation is now deprecated. This recipe will replace the
@Required
annotation with@Autowired
.Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
@timtebeek @Laurens-W
Checklist