Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reflection hints for EmbeddedDatabaseFactory$EmbeddedDataSourceProxy#shutdown #29259

Closed
sdeleuze opened this issue Oct 5, 2022 · 0 comments
Assignees
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

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Oct 5, 2022

As discussed in oracle/graal#5073, our session-jdbc AOT smoke test sample currently registers reflection entry for org.springframework.jdbc.datasource.embedded.EmbeddedDatabase#shutdown instead of org.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.

@sdeleuze sdeleuze added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Oct 5, 2022
@sdeleuze sdeleuze added this to the 6.0.0-RC1 milestone Oct 5, 2022
@sdeleuze sdeleuze self-assigned this Oct 5, 2022
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 5, 2022
This commit adds a reflection hint on
EmbeddedDatabaseFactory$EmbeddedDataSourceProxy#shutdown when
EmbeddedDatabaseFactory is reachable in order to allow its usage
as bean destroy method.

Closes spring-projectsgh-29259
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 5, 2022
This commit adds a reflection hints on
EmbeddedDatabaseFactory$EmbeddedDataSourceProxy#shutdown when
EmbeddedDatabaseFactory is reachable in order to allow its usage
as bean destroy method.

Closes spring-projectsgh-29259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant