Auto-configuration conditions and ordering
Latest stable Based on Bluetape4k release 1.11.0
Three configuration classes
Section titled “Three configuration classes”AutoConfiguration.imports registers three classes:
LettuceNearCacheHibernateAutoConfigurationLettuceNearCacheMetricsAutoConfigurationLettuceNearCacheActuatorAutoConfiguration
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.
Hibernate configuration conditions
Section titled “Hibernate configuration conditions”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: falseMetrics configuration conditions
Section titled “Metrics configuration conditions”The metrics binder requires the RegionFactory, EntityManagerFactory, and MeterRegistry classes plus actual EntityManagerFactory and MeterRegistry beans. bluetape4k.cache.lettuce-near.metrics.enabled must be true or absent.
If the application has no Actuator starter or creates no registry, the cache may still work while the binder backs off. That is an optional-feature condition, not a cache failure.
Actuator configuration conditions
Section titled “Actuator configuration conditions”The endpoint requires the Endpoint, RegionFactory, and EntityManagerFactory classes, an actual EntityManagerFactory bean, and the top-level enabled setting. It does not check the metrics setting. An endpoint bean may therefore exist while metrics are disabled, and its L2 fields may be null when Hibernate statistics are off.
HTTP exposure is separate from bean registration.
management: endpoints: web: exposure: include: health,info,nearcacheDiagnostic order
Section titled “Diagnostic order”- Find all three names in the Spring Boot condition evaluation report.
- Check top-level
enabledseparately from metricsenabled. - Verify runtime presence of
spring-boot-hibernate, the JPA starter, and Actuator. - Check the
EntityManagerFactoryandMeterRegistrybeans. - If the bean exists but HTTP does not, check management exposure.