Class LoomAutoConfiguration
java.lang.Object
com.loomcache.springboot.autoconfigure.LoomAutoConfiguration
@AutoConfiguration(beforeName="org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration")
@EnableConfigurationProperties(LoomProperties.class)
@Import(CacheNodeConfig.class)
public class LoomAutoConfiguration
extends Object
Spring Boot auto-configuration for LoomCache client and server.
Enables seamless integration with Spring Boot applications: - Automatically creates a Loom client bean configured from application.properties - Optionally creates an embedded CacheNode server if loomcache.server.enabled=true - Handles lifecycle with proper cleanup on shutdown
Configuration prefix: loomcache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionloomCacheManager(LoomCache loomClient, LoomProperties properties) Creates a Spring CacheManager backed by LoomCache.loomClient(LoomProperties properties) Creates and connects a LoomCache client.loomHealthIndicator(org.springframework.beans.factory.ObjectProvider<LoomCache> loomClientProvider, org.springframework.beans.factory.ObjectProvider<CacheNode> cacheNodeProvider) voidshutdown()Graceful shutdown: close the LoomCache client.
-
Constructor Details
-
LoomAutoConfiguration
public LoomAutoConfiguration()
-
-
Method Details
-
loomClient
@Bean @ConditionalOnMissingBean(LoomCache.class) @Conditional(LoomClientEnabledCondition.class) public LoomCache loomClient(LoomProperties properties) Creates and connects a LoomCache client.- Parameters:
properties- Spring Boot configuration properties (must not be null)- Returns:
- LoomCache client instance
- Throws:
NullPointerException- if properties is null
-
loomCacheManager
@Bean @ConditionalOnMissingBean(org.springframework.cache.CacheManager.class) @Conditional(LoomClientEnabledCondition.class) @ConditionalOnProperty(prefix="loomcache.spring-cache", name="enabled", havingValue="true", matchIfMissing=true) public LoomCacheManager loomCacheManager(LoomCache loomClient, LoomProperties properties) Creates a Spring CacheManager backed by LoomCache. Only registered if no other CacheManager bean exists.- Parameters:
loomClient- the LoomCache client instanceproperties- LoomCache configuration properties- Returns:
- a LoomCacheManager backed by the distributed cache
-
loomHealthIndicator
@Bean("loomcache") @ConditionalOnMissingBean(name="loomcache") public LoomHealthIndicator loomHealthIndicator(org.springframework.beans.factory.ObjectProvider<LoomCache> loomClientProvider, org.springframework.beans.factory.ObjectProvider<CacheNode> cacheNodeProvider) -
shutdown
Graceful shutdown: close the LoomCache client. Server lifecycle is managed byCacheNodeConfigvia@Bean(destroyMethod = "stop").- Throws:
Exception
-