Skip to content

Commit bebdf69

Browse files
committed
Document how to statically provide GraalVM hints
Closes gh-42515
1 parent 90de82a commit bebdf69

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/native-image/advanced-topics.adoc

+10-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ For further reading, please see {graal-native-image-docs}/metadata/AutomaticMeta
150150

151151
[[native-image.advanced.custom-hints]]
152152
=== Custom Hints
153-
If you need to provide your own hints for reflection, resources, serialization, proxy usage etc. you can use the `RuntimeHintsRegistrar` API.
153+
If you need to provide your own hints for reflection, resources, serialization, proxy usage and so on, you can use the `RuntimeHintsRegistrar` API.
154154
Create a class that implements the `RuntimeHintsRegistrar` interface, and then make appropriate calls to the provided `RuntimeHints` instance:
155155

156156
include::code:MyRuntimeHints[]
@@ -172,6 +172,15 @@ include::code:MyRuntimeHintsTests[]
172172

173173

174174

175+
[[native-image.advanced.custom-hints.static]]
176+
==== Providing Hints Statically
177+
If you prefer, custom hints can be provided statically in one or more GraalVM JSON hint files.
178+
Such files should be placed in `src/main/resources/` within a `+META-INF/native-image/*/*/+` directory.
179+
The <<native-image#native-image.introducing-graalvm-native-images.understanding-aot-processing,hints generated during AOT processing>> are written to a directory named `+META-INF/native-image/{groupId}/{artifactId}/+`.
180+
Place your static hint files in a directory that does not clash with this location, such as `+META-INF/native-image/{groupId}/{artifactId}-additional-hints/+`
181+
182+
183+
175184
[[native-image.advanced.known-limitations]]
176185
=== Known Limitations
177186
GraalVM native images are an evolving technology and not all libraries provide support.

spring-boot-project/spring-boot-docs/src/docs/asciidoc/native-image/introducing-graalvm-native-images.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ A Spring AOT processed application will typically generate:
5353

5454
* Java source code
5555
* Bytecode (for dynamic proxies etc)
56-
* GraalVM JSON hint files:
56+
* GraalVM JSON hint files in `+META-INF/native-image/{groupId}/{artifactId}/+`:
5757
- Resource hints (`resource-config.json`)
5858
- Reflection hints (`reflect-config.json`)
5959
- Serialization hints (`serialization-config.json`)
6060
- Java Proxy Hints (`proxy-config.json`)
6161
- JNI Hints (`jni-config.json`)
6262

63+
If the generated hints are not sufficient, you can also <<native-image#native-image.advanced.custom-hints,provide your own>>.
64+
6365

6466

6567
[[native-image.introducing-graalvm-native-images.understanding-aot-processing.source-code-generation]]

0 commit comments

Comments
 (0)