Class IdempotencyAutoConfiguration
java.lang.Object
io.github.ravocode.avoonce.spring.IdempotencyAutoConfiguration
@AutoConfiguration
@AutoConfigureAfter({CaffeineIdempotencyAutoConfiguration.class,JdbcIdempotencyAutoConfiguration.class,RedisIdempotencyAutoConfiguration.class})
@ConditionalOnClass(IdempotencyManager.class)
@EnableConfigurationProperties(IdempotencyProperties.class)
public class IdempotencyAutoConfiguration
extends Object
Spring Boot auto-configuration for the AvoOnce idempotency library.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.beans.factory.InitializingBeanFail-fast bean that throws anIllegalStateExceptionif multiple storage backends are on the classpath without an explicitavoonce.idempotency.storeproperty set.idempotencyConfig(IdempotencyProperties properties) Configures the coreIdempotencyConfigbased on application properties.org.springframework.boot.web.servlet.FilterRegistrationBean<IdempotencyFilter> idempotencyFilterRegistration(IdempotencyManager manager, IdempotencyProperties properties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping> handlerMappingProvider) Registers theIdempotencyFilteras a Spring Boot servlet filter.idempotencyManager(IdempotencyRepository repository) Creates the primaryIdempotencyManagerbean backed by the resolvedIdempotencyRepository.
-
Constructor Details
-
IdempotencyAutoConfiguration
public IdempotencyAutoConfiguration()Creates a new auto-configuration instance.
-
-
Method Details
-
idempotencyConfig
@Bean @ConditionalOnMissingBean public IdempotencyConfig idempotencyConfig(IdempotencyProperties properties) Configures the coreIdempotencyConfigbased on application properties.- Parameters:
properties- idempotency configuration properties.- Returns:
- the shared
IdempotencyConfigbean.
-
ambiguousStoreGuard
@Bean @ConditionalOnClass(name={"io.github.ravocode.avoonce.caffeine.CaffeineIdempotencyRepository","io.github.ravocode.avoonce.jdbc.JdbcIdempotencyRepository"}) @ConditionalOnBean(DataSource.class) @ConditionalOnProperty(prefix="avoonce.idempotency", name="store", havingValue="auto", matchIfMissing=true) public org.springframework.beans.factory.InitializingBean ambiguousStoreGuard()Fail-fast bean that throws anIllegalStateExceptionif multiple storage backends are on the classpath without an explicitavoonce.idempotency.storeproperty set.- Returns:
- an
InitializingBeanguard.
-
idempotencyManager
@Bean @ConditionalOnMissingBean public IdempotencyManager idempotencyManager(IdempotencyRepository repository) Creates the primaryIdempotencyManagerbean backed by the resolvedIdempotencyRepository.- Parameters:
repository- the backing store for idempotency records.- Returns:
- the core
IdempotencyManagerbean.
-
idempotencyFilterRegistration
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="avoonce.idempotency.filter", name="enabled", matchIfMissing=true) @ConditionalOnClass(name="jakarta.servlet.Filter") public org.springframework.boot.web.servlet.FilterRegistrationBean<IdempotencyFilter> idempotencyFilterRegistration(IdempotencyManager manager, IdempotencyProperties properties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping> handlerMappingProvider) Registers theIdempotencyFilteras a Spring Boot servlet filter.- Parameters:
manager- the core idempotency state machine.properties- idempotency configuration properties.handlerMappingProvider- provider for Spring'sRequestMappingHandlerMapping.- Returns:
- the filter registration bean.
-