- Latest
- 22.3
- 22.2
- 22.1
- 22.0
- 21.3
- Dev Build
- User Guides
- Access Environment Variables
- Add Logging to a Native Executable
- Build a Native Executable from a JAR File
- Build and Run Native Executables with JFR
- Build Java Modules into a Native Executable
- Build a Polyglot Native Executable
- Build a Native Shared Library
- Build a Statically Linked or Mostly-Statically Linked Native Executable
- Configure Native Image with the Tracing Agent
- Configure Dynamic Proxies Manually
- Containerise a Native Executable and Run in a Docker Container
- Create a Heap Dump
- Debug Native Executables with GDB
- Include Resources in a Native Executable
- Optimize a Native Executable with PGO
- Use GraalVM Dashboard to Optimize the Size of a Native Executable
- Configure Native Image Using Shared Reachability Metadata
- Use System Properties
Configure Dynamic Proxies Manually
You can generate dynamic proxy classes at native executable build time by specifying the list of interfaces that they implement. Native Image provides two options:
-H:DynamicProxyConfigurationFiles=<comma-separated-config-files>
-H:DynamicProxyConfigurationResources=<comma-separated-config-resources>
These options accept JSON files whose structure is an array of arrays of fully qualified interface names. For example:
[
{ "interfaces": [ "java.lang.AutoCloseable", "java.util.Comparator" ] },
{ "interfaces": [ "java.util.Comparator" ] },
{ "interfaces": [ "java.util.List" ] }
]
Note: the order of the specified proxy interfaces is significant: two requests for a
Proxy
class with the same combination of interfaces but in a different order will result in two distinct behaviors (for more detailed information, refer toClass Proxy
).
The java.lang.reflect.Proxy
API also enables you to create a dynamic proxy that does not implement any user provided interfaces.
In this case the generated dynamic proxy class implements java.lang.reflect.Proxy
only.