Arthur Logo Apache Geronimo Arthur
  • Apache
  • Documentation
  • Community
  • Downloads
  • ASF
    License Sponsorship Thanks
    Security

Arthur SPI

Arthur SPI enables you to add custom logic to generate native-image configuration.

Dependencies

<dependency>
  <groupId>org.apache.geronimo.arthur</groupId>
  <artifactId>arthur-spi</artifactId>
  <version>${arthur.version}</version>
</dependency>

Usage

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

Copyright © 1999-2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache Geronimo, Geronimo, Apache, the Apache feather logo, and the Apache Geronimo project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.