Class LegacyJpaSagaStoreAutoConfiguration
JpaSagaStore when JPA infrastructure is available, ported from
Axon Framework 4's JPA saga store wiring onto axon-legacy's JpaSagaStore builder.
Registers the SagaEntry and AssociationValueEntry entities defined in
org.axonframework.modelling.saga.repository.jpa with the persistence unit via
LegacySagaJpaEntityRegistrar, so they are picked up even though they live outside the application's own
base packages.
The sagaStore(GeneralConverter, EntityManagerProvider) bean is Lazy: JpaSagaStore's
constructor eagerly registers named queries against the EntityManager, which requires
a fully initialized persistence unit. Axon Framework 4 deferred this bean the same way for the same reason.
Runs after org.axonframework.extension.springboot.autoconfig.JpaAutoConfiguration so the
EntityManagerProvider bean it provides is available, and before LegacySagaAutoConfiguration so this
bean is visible when that class's in-memory fallback checks for an existing SagaStore. The ordering
reference to JpaAutoConfiguration uses AutoConfiguration.afterName() rather than
AutoConfiguration.after() so that axon-legacy carries no compile-time dependency on the
axon-spring-boot-autoconfigure module.
- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsagaStore(GeneralConverter converter, EntityManagerProvider entityManagerProvider)
-
Constructor Details
-
LegacyJpaSagaStoreAutoConfiguration
public LegacyJpaSagaStoreAutoConfiguration()
-
-
Method Details
-
sagaStore
@Lazy @Bean @ConditionalOnMissingBean(SagaStore.class) public JpaSagaStore sagaStore(GeneralConverter converter, EntityManagerProvider entityManagerProvider) Provides aJpaSagaStoreusing the givenconverterandentityManagerProvider.Named
sagaStore, matching Axon Framework 4's bean name, so a manually declaredSagaStorebean of that same name (rather than type) still triggersConditionalOnMissingBean's type-based check correctly sinceSagaStoreis the condition target, not the bean name.- Parameters:
converter- the converter used to convert a saga instance to and from its serialized formentityManagerProvider- the provider of theEntityManagerused to access the underlying database- Returns:
- a JPA-backed
SagaStore
-