Skip to content

Spring Boot Integration

Spring Boot Integration

Auto-configured beans, REST endpoints, and Actuator health.

application.yml
Spring Boot reads loomcache.* properties
LoomClientSync Client
AsyncLoomClientAsync Client
CacheNodeEmbedded Server
MapControllerREST /api/map
QueueControllerREST /api/queue
LockControllerREST /api/lock
CounterControllerREST /api/counter
HealthIndicatorActuator

The loom-spring-boot module targets Spring Boot 4.0.5. Drop it on the classpath, declare a seed list, and the LoomAutoConfiguration wires the rest.

<dependency>
<groupId>com.loomcache</groupId>
<artifactId>loom-spring-boot</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
loomcache:
cluster:
seeds:
- 127.0.0.1:5701
- 127.0.0.1:5702
- 127.0.0.1:5703
client:
connect-timeout-ms: 5000
request-timeout-ms: 3000

When seeds are present, LoomAutoConfiguration registers client-side beans by default:

  • LoomClient — synchronous client.
  • AsyncLoomClientCompletableFuture-returning facade.
  • LoomCacheManager implementing org.springframework.cache.CacheManager — when loomcache.spring-cache.enabled=true (the default).
  • LoomSessionRepository — when loomcache.session.enabled=true.
  • LoomHealthIndicator — picked up by Spring Boot actuator.

Embedded server beans are opt-in. Set loomcache.server.enabled=true to import the embedded CacheNode configuration; leaving it unset or false keeps the application in client-only mode.

@Cacheable("products")
public Product findById(String id) { ... }
@CachePut("products")
public Product save(Product p) { ... }
@CacheEvict("products")
public void remove(String id) { ... }

Pre-create caches at startup:

loomcache:
spring-cache:
enabled: true
cache-names: [products, users, orders]
loomcache:
session:
enabled: true
default-max-inactive-interval: 30m
map-name: loom:sessions

LoomSessionRepository stores SessionInformation in the loom:sessions map.

Mounted automatically under /api/* (see REST API). The starter exposes the default map, queue, set, topic, query, cluster, lock, atomic, multimap, list, ringbuffer, reliable-topic, and PN-counter controllers. Inputs are validated by InputValidator and @Valid; exceptions are translated by GlobalExceptionHandler. The generated OpenAPI document for these controllers is available at /v3/api-docs/loomcache-api.

LoomHealthIndicator reports the client’s connection status and a cluster health summary at /actuator/health/loomcache.

Both sections map to TlsConfig / AuthConfig:

loomcache:
tls:
enabled: true
key-store-path: /etc/loomcache/tls/keystore.p12
key-store-password: ${KEYSTORE_PASSWORD}
trust-store-path: /etc/loomcache/tls/truststore.p12
trust-store-password: ${TRUSTSTORE_PASSWORD}
require-client-auth: true
auth:
enabled: true
gateway-trust: false
user-header: X-Auth-User
roles-header: X-Auth-Roles
role-prefix: ROLE_
roles:
admin:
permissions: ["*"]
reader:
permissions: [MAP_GET, MAP_CONTAINS, MAP_SIZE]

Optional Spring Security JWT issuing:

loomcache:
security:
jwt:
enabled: true
signing-secret: ${LOOMCACHE_JWT_SIGNING_SECRET}
ttl: 15m

When enabled, authenticated Spring REST callers can POST /token to receive a short-lived HS256 Bearer token.

loom-spring-boot/src/test includes context-load tests (LoomAutoConfigurationTest), bean presence assertions (CacheNodeConfigTest), and full controller ITs.