Replace build-time initialization by constant fields

This commit leverages a subset of @philwebb initial experimentation
to compute at build time the value of specific boolean static fields
in native images. This enhancement is implemented for now as a
GraalVM feature.

The goal here is to keep an optimized footprint via build time code
removal without leveraging build-time class initialization which is known
for the blocking compatibility issues it introduces due to its viral nature.

For now, the static fields initialized at build time with native are:
 - NativeDetector#imageCode
 - Fields with a name ending by "Present" in "org.springframework" package
   typically used for classpath check with ClassUtils#isPresent

Closes gh-28624
This commit is contained in:
Sébastien Deleuze
2022-06-22 12:17:40 +02:00
parent dc4ae559c5
commit 22a750f378
16 changed files with 413 additions and 15 deletions

View File

@@ -1,2 +0,0 @@
Args = --initialize-at-build-time=org.springframework.http.HttpStatus,\
org.springframework.web.client.RestTemplate