Class AddInjectAnnotationToResourceConstructor
java.lang.Object
org.openrewrite.Recipe
com.atlassian.platform.recipes.rest.tov2.AddInjectAnnotationToResourceConstructor
- All Implemented Interfaces:
Cloneable
public class AddInjectAnnotationToResourceConstructor
extends org.openrewrite.Recipe
Recipe will examine the rest resource class files and will add javax.inject.Inject annotation to resource class constructor method
Sometimes OSGi fails to create bean of rest resource class with error "NoSuchMethodException: Could not find a suitable constructor"
Then adding javax.inject.Inject annotation to rest resource class constructor help OSGi to identify the constructor method.
This recipe will find all the rest resource constructor methods where resource class has javax.inject.Inject.Path annotation
and add @Inject annotation to it if it is not there.
It will also add import of janax.inject.Inject to rest resource class too.
This recipe will not add maven dependency for javax.inject.Inject package
There is another recipe named com.atlassian.platform.recipes.rest.tov2.AddInjectAnnotationToResourceConstructorWithDependency to do it
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass -
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> Methods inherited from class org.openrewrite.Recipe
addDataTable, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll
-
Constructor Details
-
AddInjectAnnotationToResourceConstructor
public AddInjectAnnotationToResourceConstructor()
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-