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 @Autowired or @Inject field of a Saga, being a class with a @SagaEventHandler method or the Spring @Saga stereotype;
  • a class member, or a class declaration, that uses one of the Axon Framework 4 ResourceInjector types, or that calls configureResourceInjector(..) or registerResourceInjector(..).
A 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.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

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MarkSagaResourceInjection

      public MarkSagaResourceInjection()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe