Class SpringAxonConfiguration

java.lang.Object
org.axonframework.spring.config.SpringAxonConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<Configuration>, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class SpringAxonConfiguration extends Object implements org.springframework.beans.factory.FactoryBean<Configuration>, org.springframework.context.SmartLifecycle
Factory Bean implementation that creates an Axon Configuration for a Configurer. This allows a Configuration bean to be available in an Application Context that already defines a Configurer.

This factory bean will also ensure the Configuration's lifecycle is attached to the Spring Application lifecycle.

Since:
4.6.0
Author:
Allard Buijze
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The SmartLifecycle.getPhase() value of this is set to be safely lower than the typical values listed in the Spring WebServer lifecycles.

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize this Configuration instance.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    int
     
    boolean
     
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.beans.factory.FactoryBean

    isSingleton

    Methods inherited from interface org.springframework.context.SmartLifecycle

    isAutoStartup, stop
  • Field Details

    • LIFECYCLE_PHASE

      public static final int LIFECYCLE_PHASE
      The SmartLifecycle.getPhase() value of this is set to be safely lower than the typical values listed in the Spring WebServer lifecycles. This means we make sure that: - Axon is ready when the web server starts - The web server is stopped before tearing down Axon
      See Also:
  • Constructor Details

    • SpringAxonConfiguration

      public SpringAxonConfiguration(Configurer configurer)
      Initialize this Configuration instance.
      Parameters:
      configurer - The configurer to get the Configuration from.
  • Method Details

    • getObject

      @NonNull public Configuration getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<Configuration>
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<Configuration>
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • setApplicationContext

      @Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle