Announcing GraalVM support in Azure SDK for Java and Spring Cloud Azure libraries

Jonathan Giles

The Azure SDK for Java and Spring Cloud Azure teams are proud to announce the integration of GraalVM in their client libraries. GraalVM, a high-performance polyglot virtual machine, enables the execution of applications written in multiple programming languages, including Java.

One of the key features of GraalVM is its support for ahead-of-time (AOT) compilation, which in some cases can enable faster startup times and improved runtime performance compared to traditional just-in-time (JIT) compilation. Performance is especially important for developers using cloud platforms such as Azure. Azure deployments can scale to extreme levels, where large volumes of requests and fast response times are table stakes. By incorporating GraalVM into the Azure SDK for Java, developers can take advantage of the benefits of AOT compilation, delivering high-performance, low-latency applications that meet the demands and expectations of Azure customers.

This new feature reinforces the Azure SDK for Java’s commitment to evolving and providing a comprehensive set of tools for building cloud-based applications. The integration of GraalVM into the Azure SDK for Java represents a significant step forward. Developers are now able to build and deploy high-performance Java applications on Azure, using the power of AOT compilation to meet the demands of the cloud platform.

We have been working on building out our GraalVM support over the last 18 months. The Azure SDK for Java team has explored many ways to support GraalVM in our libraries, and finally we’re happy with what we have to offer to you today. In particular, the Azure SDK for Java GraalVM support doesn’t impose any extra dependencies or code changes on end users. For Spring Cloud Azure, experimental support for GraalVM native compilation was initially achieved via the Spring Native project. With Spring Boot 3 and Spring 6, support for native images is now available as a core feature within Spring Cloud Azure. Spring Cloud Azure 5.x is compatible with Spring Boot 3, and support for native images is in Spring Cloud Azure 5.1.0.

Get started

Install GraalVM and Native Image

To get started, you need to install GraalVM and prepare your development system for compiling native images. The installation process for GraalVM is straightforward, and the GraalVM documentation provides step-by-step instructions for installing GraalVM and using GraalVM to install native-image. Follow the prerequisites section carefully to install the necessary native compilers for your operating system.

After installing GraalVM, you need to configure Maven or Gradle, which requires changes to your build script. There is documentation over at the Azure SDK for Java doc site on setting up Maven and Gradle builds for Azure SDK for Java. The latest releases of the Azure SDK for Java and Azure Spring Cloud libraries come with all the necessary GraalVM metadata. You don’t have to add extra dependencies to your project files. You can find instructions for Maven and Gradle on the GraalVM website.

If you’re starting a new project, you can use the Azure SDK for Java Maven archetype, which automatically creates a project with GraalVM support.

Next, you’re ready to run a native image build. You can use standard Maven or Gradle tooling, but you need to include the flags specified in the previous section to access GraalVM’s tooling. For Maven, use the command:

mvn clean package -Pnative

For Gradle, use the command:

gradle nativeCompile

After you run one of the above commands, GraalVM outputs a native executable for the platform it’s running on. It appears in the Maven /target or Gradle build/native/nativeCompile directories. You can now run your application with this executable file, and it should perform similarly to a standard Java application.


To help you get started quickly, the Azure SDK for Java and Spring Cloud Azure teams have created several end-to-end samples that demonstrate what’s possible with GraalVM and the Azure SDK for Java. You can find these samples at the two links below:

GraalVM implications

GraalVM holds the potential to deliver significant performance benefits for specific types of applications. By utilizing GraalVM, you can develop applications that are fast, responsive, lightweight, and low-latency. However, it’s crucial to recognize that GraalVM may not always provide the ideal solution. In some cases, a native image built with GraalVM may perform worse than a Java application compiled just-in-time. Therefore, it’s essential to conduct real-world tests for both deployment methods.

To ensure the reliability of your GraalVM application, you can begin by taking advantage of the recently added support for native compilation of JUnit tests. If your project uses JUnit, consider compiling your unit tests natively and running them. Using JUnit can increase your confidence that the natively compiled application continues to function as expected. The Azure SDK team has established several continuous integration pipelines to validate their implementation and catch any issues early.

Once you’ve confirmed that the code operates as intended, it’s advisable to examine the effects of a native image application on your application. You should check the dynamic behavior, logging infrastructure, configuration support, and more, to ensure your application continues to operate as expected. Additionally, you should understand the different characteristics of a natively compiled application, such as runtime profiling and debugging.

Finally, GraalVM Community Edition ships with the Serial Garbage Collector (GC) as the only GC available for use. You should carefully review the GraalVM memory management documentation to understand how GraalVM may affect your software. The Serial GC is optimized for low memory usage and small Java heap sizes, and a thorough understanding of its behavior is essential.


When the Azure SDK for Java and Spring Cloud Azure libraries are used with GraalVM, developers have the potential to create high-performance, low-latency applications. With its ability to compile Java code into native images, GraalVM can help you create applications that are faster and more responsive, while also being lightweight. Try it out today and see the benefits for yourself!

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Anbu 0

    Nice to see GraalVM native support.

Feedback usabilla icon