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

Arthur OpenWebBeans Knights

Arthur OpenWebBeans knight is responsible to support Apache OpenWebBeans. It preconfigures the most of the reflection and resource inclusion.

It assumes you use openwebbeans-se in your project. Here is a sample dependencies block for a simple SCR application:

<dependencies>
  <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jcdi_2.0_spec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-el_2.2_spec</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-annotation_1.3_spec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-atinject_1.0_spec</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-interceptor_1.2_spec</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-se</artifactId>
      <version>2.0.21</version>
    </dependency>
</dependencies>
this only works out of the box with OpenWebBeans 2.0.21 or later. You’ll need to tune the scanner service yourself for older versions.

Coordinates

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

Usage

To make a CDI application compatible with native-image there are a few necessary steps to do:

  1. Generate all CDI proxies (normal scope beans, intercepted/decorated beans)

  2. Include the proxies in the final image

  3. Include OpenWebBeans log resource bundle

  4. Register bean classes for reflection

The openwebbeans-knight handles most of that even if you can need to tune a few details in the Arthur configuration.

Finally, you must register the openwebbeans knight in arthur-maven-plugin:

<plugin>
  <groupId>org.apache.geronimo.arthur</groupId>
  <artifactId>arthur-maven-plugin</artifactId>
  <version>${arthur.version}</version>
  <configuration>
    <main>org.company.cdi.Main</main>
    <graalExtensions>
      <graalExtension>openwebbeans</graalExtension>
    </graalExtensions>
  </configuration>
</plugin>

Configuration

This knight has several configuration options:

Name Type Description

extension.openwebbeans.classes.filter.[includes|excludes]

String

Comma separated values for scanning filter (packages).

extension.openwebbeans.classes.includeAsResources

boolean

Should classes be included as resources (.class) too.

extension.openwebbeans.container.se.disableDiscovery

boolean

Should CDI SE container auto discover the beans or not.

extension.openwebbeans.container.se.properties

Properties

CDI SE properties.

extension.openwebbeans.container.se.properties.runtime.excludes

Properties

properties names to not keep in openwebbeans.properties at runtime (but use at build time if set in previous option).

extension.openwebbeans.container.se.services

Properties

OpenWebBeans services as properties (SPI=IMPL).

extension.openwebbeans.container.se.classes

String list

Bean classes to register.

extension.openwebbeans.extension.excludes

String list

Extension fully qualified name prefixes to exclude undesired extensions.

extension.openwebbeans.runtime.properties.skipOptimizations

boolean

By default the knight will enable some optimization properties like skipping validation and @Vetoed on packages. If undesired set it to true.

org.apache.openwebbeans.se.PreScannedCDISeScannerService.classesTemplate

String

By default ${classes} which is evaluated to the list of scanned classes. This placeholder can be used to force some other classes in the final template (${classes},org.foo.MyClass).

Jakarta

If you are using CDI under jakarta namespace, OpenWebBeans jakarta is supported through a shade. You must define as extensions or dependencies the openwebbeans Jakarta stack (openwebbeans-se-bom artifact can help) with the openwebbeans-knight with jakarta classifier.


Previous: Knights

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.