Azure Function with Spring Boot Native and GraalVM | Java

View Code

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

Inspired by Julien Dubois and Spring Native - Cloud Function Netty example.

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
  2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    $ az login
  3. Set the Azure region location:

    $ pulumi config set azure-native:location westus
  4. Run pulumi up to preview and deploy changes:

    $ pulumi up
    Previewing changes:
    Performing changes:
        + X created
    Duration: ...
  5. Check the deployed website endpoint:

    $ pulumi stack output endpoint
    $ 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