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

Ebean support graalvm/native image? #2895

Closed
sirlordt opened this issue Nov 21, 2022 · 3 comments · Fixed by #3249
Closed

Ebean support graalvm/native image? #2895

sirlordt opened this issue Nov 21, 2022 · 3 comments · Fixed by #3249
Assignees
Milestone

Comments

@sirlordt
Copy link

Expected behavior

Native compile in linux

@rbygrave
Copy link
Member

See the discussion at: #2845

@rbygrave
Copy link
Member

Ebean is not currently compatible with native-image out of the box. There are 4 issues to address:

  • Use of _ebean_props field via reflection (that ebean uses on startup only)
  • Use of reflection to create an initial "prototype instance" for each entity bean (ebean uses reflection to create a prototype for all the concrete entity beans)
  • Use of invoke dynamic when using DTO Queries (this also classifies as reflection)
  • Via avaje-config, optional use of application.properties / application.yaml in as resources included in the image. We can fix this in avaje-config itself.

The way to fix these issues is to register each entity bean (including abstract ones) for reflection via reflect-config.json.

For projects using the querybean-generator annotation processor [to generate query beans] we will get this annotation processor to additionally generate the reflect-config.json for us. So then it will all work out-of-the-box except for DTO queries.

I'm pondering adding an annotation such that we can specify the classes we are using for DTO queries and then the querybean-generator can additionally register those classes in the generated reflect-config.json.

@rbygrave rbygrave self-assigned this Oct 16, 2023
@rbygrave rbygrave linked a pull request Oct 17, 2023 that will close this issue
@rbygrave
Copy link
Member

Also note that avaje-config 3.9 supports native-image in terms of embedded resources (e.g. having a src/main/resources/application.properties included in the built image).

@rbygrave rbygrave added this to the 13.23.1 milestone Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants