Add reflection hints for EmbeddedDatabaseFactory$EmbeddedDataSourceProxy#shutdown #29259
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Milestone
As discussed in oracle/graal#5073, our
session-jdbc
AOT smoke test sample currently registers reflection entry fororg.springframework.jdbc.datasource.embedded.EmbeddedDatabase#shutdown
instead oforg.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory$EmbeddedDataSourceProxy#shutdown
.It comes from EmbeddedDataSourceConfiguration and the inference is done here. The reflection registration on the class instance is needed to make it work on GraalVM 22.3 (we are not sure why that does not break on 22.2). By design, we can't know the concrete type of the
EmbeddedDatabase
without instantiating the bean which is not possible at AOT stage I think.As discussed with @wilkinsona in spring-projects/spring-boot#32581, it should be Spring Framework responsibility to provide an arrangement that works out of the box. Providing hints with a type reachable condition on
EmbeddedDatabaseFactory
is IMO a good enough way to achieve that.The text was updated successfully, but these errors were encountered: