Class JdbcIdempotencyAutoConfiguration
java.lang.Object
io.github.ravocode.avoonce.spring.JdbcIdempotencyAutoConfiguration
@AutoConfiguration
@AutoConfigureAfter(name="org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration")
@ConditionalOnClass({JdbcIdempotencyRepository.class,DataSource.class})
@EnableScheduling
public class JdbcIdempotencyAutoConfiguration
extends Object
Auto-configuration for JDBC-backed idempotency repositories.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classScheduled background task that triggers eviction of expired records from the JDBC store. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new auto-configuration instance. -
Method Summary
Modifier and TypeMethodDescriptionjdbcAutoRepository(DataSource dataSource, IdempotencyConfig config) Auto-wires the JDBC repository when DataSource is present, Caffeine is absent, and store property is auto.jdbcEvictionTask(JdbcIdempotencyRepository repository) Configures the scheduled background cleanup task for expired JDBC idempotency records.jdbcExplicitRepository(DataSource dataSource, IdempotencyConfig config) Wires the JDBC repository whenavoonce.idempotency.store=jdbcis explicitly set.org.springframework.beans.factory.InitializingBeanjdbcTableInitializer(DataSource dataSource) Automatically initializes the idempotency database table if auto-ddl is enabled.
-
Constructor Details
-
JdbcIdempotencyAutoConfiguration
public JdbcIdempotencyAutoConfiguration()Creates a new auto-configuration instance.
-
-
Method Details
-
jdbcAutoRepository
@Bean @ConditionalOnMissingBean(IdempotencyRepository.class) @ConditionalOnMissingClass("com.github.benmanes.caffeine.cache.Cache") @ConditionalOnProperty(prefix="avoonce.idempotency", name="store", havingValue="auto", matchIfMissing=true) public JdbcIdempotencyRepository jdbcAutoRepository(DataSource dataSource, IdempotencyConfig config) Auto-wires the JDBC repository when DataSource is present, Caffeine is absent, and store property is auto.- Parameters:
dataSource- the Spring DataSource bean.config- the shared idempotency configuration.- Returns:
- the
JdbcIdempotencyRepositorybean.
-
jdbcExplicitRepository
@Bean @ConditionalOnMissingBean(IdempotencyRepository.class) @ConditionalOnProperty(prefix="avoonce.idempotency", name="store", havingValue="jdbc") public JdbcIdempotencyRepository jdbcExplicitRepository(DataSource dataSource, IdempotencyConfig config) Wires the JDBC repository whenavoonce.idempotency.store=jdbcis explicitly set.- Parameters:
dataSource- the Spring DataSource bean.config- the shared idempotency configuration.- Returns:
- the
JdbcIdempotencyRepositorybean.
-
jdbcTableInitializer
@Bean @ConditionalOnBean(JdbcIdempotencyRepository.class) @ConditionalOnProperty(prefix="avoonce.idempotency.jdbc", name="auto-ddl", havingValue="true", matchIfMissing=true) public org.springframework.beans.factory.InitializingBean jdbcTableInitializer(DataSource dataSource) Automatically initializes the idempotency database table if auto-ddl is enabled.- Parameters:
dataSource- the Spring DataSource bean.- Returns:
- the
InitializingBeaninitializer.
-
jdbcEvictionTask
@Bean @ConditionalOnBean(JdbcIdempotencyRepository.class) @ConditionalOnProperty(prefix="avoonce.idempotency.jdbc.eviction", name="enabled", havingValue="true", matchIfMissing=true) public JdbcIdempotencyAutoConfiguration.JdbcEvictionTask jdbcEvictionTask(JdbcIdempotencyRepository repository) Configures the scheduled background cleanup task for expired JDBC idempotency records.- Parameters:
repository- the JDBC idempotency repository.- Returns:
- the
JdbcIdempotencyAutoConfiguration.JdbcEvictionTaskbean.
-