Azure GraalVM Support client library for Java - version 1.0.0-beta.3

IMPORTANT Please note that this package is deprecated and will no longer be updated. The necessary configuration files to support native image compilation using GraalVM is now directly available on respective client libraries. It is no longer required to add this package as a dependency to build native images with Azure SDK for Java. Please refer to the blog post for more details on GraalVM support in Azure SDK for Java.

The Azure GraalVM Support client library provides support for applications using Azure client libraries to be built as GraalVM native images. The library contains all the necessary configuration files and GraalVM features required to build a native image of an application that uses Azure client libraries.

NOTE:: This library is a preview and is intended to enable applications using Azure client libraries to quickly build and validate native images. However, this is not a stable, GA version and is not officially supported to use in production environments.

Getting started

Prerequisites

For more details, please refer to Getting started with GraalVM documentation.

Include the package

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-aot-graalvm-support</artifactId>
    <version>1.0.0-beta.3</version>
</dependency>

Also, include the azure-aot-graalvm-support-netty package to bring in the configuration files required for Netty HTTP client. For more details on this library, please refer to this README.

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-aot-graalvm-support-netty</artifactId>
    <version>1.0.0-beta.3</version>
</dependency>

Key concepts

Native Image creation

Native Image is a technology to compile your Java application ahead of time into a native image which can run as a standalone application. The native image created through this ahead-of-time compilation will include all the necessary classes from the application, it's dependencies and any other natively linked JDK code. For more details on creating the native image please refer to building a native image documentation.

GraalVM configuration files

GraalVM is a high-performance runtime that creates native images by compiling the Java code ahead of time. Due to this ahead-of-time compilation into a native image, the native image creation requires statically analyzing all classes of the application and their dependencies to determine which classes and methods are reachable during the application execution. However, there are scenarios where Java allows looking up classes, methods and fields at runtime through reflection. While GraalVM does a best-effort discovery of all classes ahead of time, it will not be able to detect all classes that are reflectively accessed. So, developers can provide configuration files that contain details of all necessary classes that are reflectively accessed. This supplementary information is then used to create the native image and make these classes available at runtime.

This library provides all the necessary configuration files for using Azure client libraries.

Examples

App Configuration

Please refer to Application Configuration client library documentation for more details.

Key Vault

Please refer to Key Vault client library documentation for more details.

Storage Blob

Please refer to Storage Blob client library documentation for more details.

Event Hubs

Please refer to Event Hubs client library documentation for more details.

Form Recognizer

Please refer to Form Recognizer client library documentation for more details.

Text Analytics

Please refer to Text Analytics client library documentation for more details.

Troubleshooting

Next steps

The azure-aot-graalvm-samples library consists of all above samples bundled into a single Maven project that can be compiled with mvn clean install -Pnative to build the native image and execute all the samples.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Impressions