Skip to content
Bluetape4k docs1.11

Spring Boot and ecosystem paths

Latest stable Based on Bluetape4k release 1.11.0

Separate the provider from auto-configuration

Section titled “Separate the provider from auto-configuration”

This module contains the Hibernate RegionFactory. Add the separate Spring Boot artifact for property binding, HibernatePropertiesCustomizer, Micrometer, and Actuator.

dependencies {
implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))
implementation("io.github.bluetape4k:bluetape4k-spring-boot-hibernate-lettuce")
}

The Boot module exposes the core provider as an API dependency; consumers still manage only the central BOM.

bluetape4k:
cache:
lettuce-near:
redis-uri: redis://localhost:6379
codec: lz4fory
use-resp3: true
local:
max-size: 10000
expire-after-write: 30m
redis-ttl:
default: 120s
regions:
io.example.Product: 300s
metrics:
enabled: true
enable-caffeine-stats: true

Auto-configuration maps these values to hibernate.cache.lettuce.* and enables second-level caching. enabled=false backs it off. Metrics also enables Hibernate statistics, so measure its production cost.

bluetape4k-spring-boot-hibernate-lettuce-demo contains a Product entity, Spring Data repository, cache controller, and real configuration. Verify the provider contract with core tests, then use the demo to connect HTTP requests to cache statistics.

Terminal window
./gradlew :bluetape4k-spring-boot-hibernate-lettuce-demo:bootRun

Do not copy demo settings directly into production. Redis authentication and TLS, database migration, TTL, pools, and observability remain deployment decisions.

Learning goalContinue withWhy
Entity and transaction basicsbluetape4k-hibernateUnderstand ORM lifecycle before caching it.
Direct Near Cache usebluetape4k-cache-lettuceUse cache APIs outside Hibernate regions.
Redis commands and codecsbluetape4k-lettuceInspect the Lettuce client and serialization layer.
Boot Metrics and ActuatorSpring Boot Hibernate LettuceAdd auto-configuration and operational endpoints.
Repository cache strategiesexposed-workshopCompare cache-aside and read/write-through around repositories.

Hibernate second-level caching owns entity state and query results inside the Hibernate lifecycle. The Exposed workshop’s JdbcCacheRepository, EntityMapLoader, and EntityMapWriter instead put read-through, write-through, or write-behind ownership in an application repository. These are different ownership models, not interchangeable labels.