---
title: "Azure Function with Spring Boot Native and GraalVM"
description: "Deploys Spring Boot application packaged with GraalVM using Pulumi on Azure from Java definitions"
url: "https://www.pulumi.com/dev/examples/azure-java-function-graal-spring/"
image: "https://www.pulumi.com/assets/og/dev/examples/azure-java-function-graal-spring.png"
---

# Azure Function with Spring Boot Native and GraalVM

Deploys Spring Boot application packaged with GraalVM using Pulumi on Azure from Java definitions

- Source on GitHub: https://github.com/pulumi/examples/tree/master/azure-java-function-graal-spring

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/azure-java-function-graal-spring) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set azure-java-function-graal-spring
cd pulumi-examples/azure-java-function-graal-spring
```

Starting point for building Spring Native application hosted in Azure Function.

Inspired by [Julien Dubois](https://github.com/jdubois/azure-native-spring-function)
and [Spring Native - Cloud Function Netty example](https://github.com/spring-projects-experimental/spring-native/tree/main/samples/cloud-function-netty).

Azure Functions custom handlers are used to run the GraalVM binary.

## Running the App in Azure

1.  Create a new stack:

    ```
    $ pulumi stack init dev
    ```

1.  Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    ```
    $ az login
    ```

1. Set the Azure region location:

    ```
    $ pulumi config set azure-native:location westus
    ```

1.  Run `pulumi up` to preview and deploy changes:

    ```
    $ pulumi up
    Previewing changes:
    ...

    Performing changes:
    ...
    Resources:
        + X created
    Duration: ...
    ```

1.  Check the deployed website endpoint:

    ```
    $ pulumi stack output endpoint
    https://<identifier>.web.core.windows.net/api/hello
    $ curl "$(pulumi stack output endpoint)"
    {"message":"Hello from Spring, Pulumi!"}
    ```

## Running the App locally

1. Run Spring Boot application and send a request:

    ```
    gradle bootRun
    curl localhost:8080
    ```
