Package org.axonframework.migration
Class MarkSagaResourceInjection
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.MarkSagaResourceInjection
- All Implemented Interfaces:
Cloneable
public class MarkSagaResourceInjection
extends org.openrewrite.Recipe
Leaves a
// TODO(axon4to5): marker wherever an Axon Framework 4 Saga relies on resource injection, which
the Axoniq Framework legacy module does not port.
Axon Framework 4 injected collaborators into @Autowired or @Inject fields of a Saga instance through
a ResourceInjector. Axon Framework 5 resolves those collaborators as parameters of the
@SagaEventHandler or @DeadlineHandler method instead. Which handlers need which collaborator is a
decision this recipe does not take, so it marks the two places that need manual work:
- an
@Autowiredor@Injectfield of a Saga, being a class with a@SagaEventHandlermethod or the Spring@Sagastereotype; - a class member, or a class declaration, that uses one of the Axon Framework 4
ResourceInjectortypes, or that callsconfigureResourceInjector(..)orregisterResourceInjector(..).
CommandGateway field is not marked when it runs after
MigrateCommandGatewayInSagaEventHandler, which already replaces that field with a handler parameter. The
recipe is idempotent: a member that already carries the marker is left alone.- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe -
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, aggregateDataTableDescriptors, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions
-
Constructor Details
-
MarkSagaResourceInjection
public MarkSagaResourceInjection()
-
-
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
-