add AOT & native image support#638
Merged
reta merged 4 commits intoopensearch-project:mainfrom Apr 17, 2026
Merged
Conversation
rursprung
commented
Mar 26, 2026
5493b12 to
04f978a
Compare
5 tasks
reta
reviewed
Mar 26, 2026
reta
reviewed
Mar 26, 2026
Contributor
Author
|
good news! spring-projects/spring-data-elasticsearch#3267 got merged and cherry-picked to their 6.0.x branch (spring-projects/spring-data-elasticsearch@6b3646b) 🥳 |
rursprung
commented
Apr 13, 2026
04f978a to
056fdda
Compare
5 tasks
rursprung
commented
Apr 17, 2026
this registers the necessary hints for [Ahead-of-Time Processing] to support both AOT and [GraalVM Native Image] usage. it also modifies one example application so that it can - optionally - be run as a native image to show that it works. this is also used in CI to test that it still builds. on its own this will fail since by using AOT we automatically also pull in the AOT hints registered in `spring-data-elasticsearch` which in turn currently unconditionally registers hints for the Elasticsearch Client (ELC) which we however exclude as a transient dependency. thus a PR has been raised to make this optional: spring-projects/spring-data-elasticsearch#3267 this has been merged in `spring-data-elasticsearch` on `main` (v6.1.x), `6.0.x` and `5.5.x` and been released as part of v5.5.11 and v6.0.5. `ElasticsearchClientAutoConfiguration` also needs to be excluded in the `MarketplaceApplication` since otherwise two `JacksonJsonpMapper` beans will be present and the application will fail to start in the `processAot` phase. `@since` is set to 2.0.6 since this will be cherry-picked also to that release, offering AOT & native image support on Spring Boot 3.5.x, 4.0.x and 4.1.x. resolves opensearch-project#411 [Ahead-of-Time Processing]: https://docs.spring.io/spring-boot/reference/packaging/aot.html [GraalVM Native Image]: https://docs.spring.io/spring-boot/reference/packaging/native-image/index.html Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
056fdda to
f850946
Compare
Signed-off-by: Andriy Redko <drreta@gmail.com>
Contributor
Author
|
btw, here are performance numbers using oha for the test application: using AOT & native image: normal JVM: the speedup is significant (factor 2) |
reta
reviewed
Apr 17, 2026
reta
reviewed
Apr 17, 2026
Signed-off-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
reta
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this registers the necessary hints for Ahead-of-Time Processing to support both AOT and GraalVM Native Image usage. it also modifies one example application so that it can - optionally - be run as a native image to show that it works. this is also used in CI to test that it still builds.
on its own this will fail since by using AOT we automatically also pull in the AOT hints registered in
spring-data-elasticsearchwhich in turn currently unconditionally registers hints for the Elasticsearch Client (ELC) which we however exclude as a transient dependency. thus a PR has been raised to make this optional: spring-projects/spring-data-elasticsearch#3267 this will have to be merged & released first for this PR to work.i have however verified things locally (though admittedly on the previous major release since i only had GraalVM 21 at hand and SB 4.x requires GraalVM 25).
Issues Resolved
resolves #441
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.