<dependency>
<groupId>org.apache.geronimo.arthur</groupId>
<artifactId>arthur-spi</artifactId>
<version>${arthur.version}</version>
</dependency>
Arthur SPI enables you to add custom logic to generate native-image
configuration.
<dependency>
<groupId>org.apache.geronimo.arthur</groupId>
<artifactId>arthur-spi</artifactId>
<version>${arthur.version}</version>
</dependency>
You must implement a org.apache.geronimo.arthur.spi.ArthurExtension
and register it as a SPI (fully qualified name in META-INF/services/org.apache.geronimo.arthur.spi.ArthurExtension
).
This extension will have to implement execute(Context)
method to register reflection, resource, … metadata needed by native-image
build.
Here is an example:
public class MyJaxbExtension implements ArthurExtension {
@Override
public void execute(final Context context) {
context.findAnnotatedClasses(XmlRootElement.class).stream()
.flatMap(clazz -> createReflectionModel(clazz))
.forEach(context::register);
}
// createReflectionModel() just instantiate a ClassReflectionModel instance
}
you can use context.finder() to find classes based on some annotation.
|
Previous: Arthur API Next: Arthur Implementation