-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Add GraalVM native JSON configuration generation #28131
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
Conversation
I think I am going to update that PR to use |
I have updated the PR to expose a single |
I've just discussed this with @sdeleuze because I remembered a specific point about the AOT processing in Spring Native: this processing phase is triggered by the build plugins as they fork a JVM process using the application runtime classpath. This last point is necessary since all the classloader detections need to happen in a consistent fashion with the actual runtime behavior of the application. Using Jackson as a required dependency means that build plugins would have to artificially add Jackson as a dependency to the runtime classpath, thus invalidating Jackson auto-detection during the AOT processing. This is why in Spring Native we chose to use/shade the vaadin "android-json" dependency to manipulate JSON. We had more specific needs there, such as reading/merging/writing JSON documents. In this case, since we're only writing a document out, maybe we should use a |
...ng-core/src/main/java/org/springframework/aot/hint/nativex/NativeConfigurationGenerator.java
Outdated
Show resolved
Hide resolved
...ore/src/main/java/org/springframework/aot/hint/nativex/JavaSerializationHintsSerializer.java
Outdated
Show resolved
Hide resolved
421e0df
to
79e0f13
Compare
...-context/src/main/java/org/springframework/context/nativex/NativeConfigurationGenerator.java
Outdated
Show resolved
Hide resolved
...-context/src/main/java/org/springframework/context/nativex/NativeConfigurationGenerator.java
Outdated
Show resolved
Hide resolved
The application used to validate it works as expected is https://github.com/sdeleuze/generate-native-config. |
This commit implements 4 package private Json serializers for JavaSerializationHints, ProxyHints, ReflectionHints and ResourceHints to serialize GraalVM native JSON configuration as documented in https://www.graalvm.org/22.0/reference-manual/native-image/BuildConfiguration/. It exposes the related functionality via NativeConfigurationGenerator which allows to generate the relevant files on the filesystem via the FileNativeConfigurationGenerator implementation. The generated *-config.json files have been validated working with GraalVM 22.0. Closes spring-projectsgh-27991
834c48d
to
2e25f34
Compare
Merged via 77e0100. |
Here is a PR intended to be a proposal to implement #27991.
The related commit implements 4 package private Jackson
JsonSerializer
forJavaSerializationHints
,ProxyHints
,ReflectionHints
andResourceHints
to serialize GraalVM native JSON configuration as documented in https://www.graalvm.org/22.0/reference-manual/native-image/BuildConfiguration/.It exposes the related functionality via
NativeConfigurationGenerator
which allows to generate the relevant files on the filesystem.The generated
*-config.json
files has been validated working with GraalVM 22.0.Looking forward to your feedback @jhoeller.