Skip to content
Bluetape4k docs2.0

Auto-configuration conditions and ordering

Latest stable Based on Bluetape4k release 2.0.0

Contract scope: 2.0.0 current contract on develop. The stable rollback reference remains 2.0.0.

AutoConfiguration.imports registers three classes:

  1. LettuceNearCacheHibernateAutoConfiguration
  2. LettuceNearCacheMetricsAutoConfiguration
  3. LettuceNearCacheActuatorAutoConfiguration

The first creates a HibernatePropertiesCustomizer. The other two add observation after Hibernate setup. Metrics and Actuator also declare ordering after Spring Boot JPA auto-configuration.

The Hibernate configuration requires LettuceNearCacheRegionFactory and EntityManagerFactory on the classpath. bluetape4k.cache.lettuce-near.enabled must be true or absent.

It does not wait for an EntityManagerFactory bean because the customizer must contribute properties before that factory is created. ApplicationContextRunner proves that enabled=false removes the customizer.

bluetape4k:
cache:
lettuce-near:
enabled: false

The metrics binder requires the RegionFactory, EntityManagerFactory, and MeterRegistry classes plus actual EntityManagerFactory and MeterRegistry beans. Both bluetape4k.cache.lettuce-near.enabled and bluetape4k.cache.lettuce-near.metrics.enabled must be true or absent. Root disable cannot be overridden by enabling metrics.

If the application creates no MeterRegistry, the cache may still work while the binder backs off. That is an optional-feature condition, not a cache failure. The Actuator dependency separately controls endpoint registration.

The endpoint requires the Endpoint, RegionFactory, and EntityManagerFactory classes plus an actual EntityManagerFactory bean. It uses the same root and metrics property gates as the binder, but it does not require a MeterRegistry bean. Disabling either property removes the endpoint bean.

HTTP exposure remains separate from bean registration. A registered endpoint is reachable over HTTP only when management.endpoints.web.exposure.include contains nearcache or an equivalent exposure rule applies.

management:
endpoints:
web:
exposure:
include: health,info,nearcache

The matrix assumes that the classpath conditions described above are satisfied.

Root enabledmetrics.enabledEntityManagerFactoryMeterRegistryActuatorResult
falseanyanyanyanyNo customizer, binder, or endpoint bean
truefalsepresentpresent or absentpresent or absentHibernate customizer only
truetrueabsentanyanyNo binder or endpoint bean
truetruepresentabsentpresentEndpoint bean only; no Micrometer binder
truetruepresentpresentabsentMetrics binder only; no endpoint bean
truetruepresentpresentpresentBinder and endpoint bean; HTTP still needs exposure
  1. Find all three names in the Spring Boot condition evaluation report.
  2. Check bluetape4k.cache.lettuce-near.enabled before bluetape4k.cache.lettuce-near.metrics.enabled.
  3. Verify runtime presence of spring-boot-hibernate, the JPA starter, and Actuator.
  4. Check the EntityManagerFactory and MeterRegistry beans.
  5. If the endpoint bean exists but HTTP does not, check management.endpoints.web.exposure.include.