When building https://github.com/spring-projects/spring-petclinic with Spring Boot 4.0.0-SNAPSHOT
, I get the following error:
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively read or write field
private volatile com.zaxxer.hikari.pool.HikariPool com.zaxxer.hikari.HikariDataSource.pool
This reflective operation seems to be done via DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration$DataSourcePoolMetadataMeterBinder.bindTo
-> MeterRegistryPostProcessor.lambda$applyBinders
. In DataSourceBuilderRuntimeHints
I see a reflective hint for HikariDataSource
but not for its pool
field.
It works fine with Spring Boot 3.5.3
or Spring Boot 4.0.0-SNAPSHOT
with a RuntimeHintsRegistrar
performing hints.reflection().registerType(HikariDataSource.class, builder -> builder.withField("pool"));
, so maybe Spring Boot 4 should add this reflective hint.
Comment From: wilkinsona
The reflective call is made here. It's been there since we introduced DataSource metrics in Spring Boot 1.2. It's not clear to me what has changed in Spring Boot 4 to cause it to fail now.
Comment From: wilkinsona
With Boot 3.x, the jdbc.connections.active
and jdbc.connections.idle
metrics are missing. Adding the hint that allows access to the pool
field fixes this so I think there was a problem lurking and something has brought it to light.