Azure Function with Spring Boot Native and GraalVM
Deploys Spring Boot application packaged with GraalVM using Pulumi on Azure from Java definitions
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set azure-java-function-graal-springcd pulumi-examples/azure-java-function-graal-springStarting 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#
-
Create a new stack:
$ pulumi stack init dev -
Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
$ az login -
Set the Azure region location:
$ pulumi config set azure-native:location westus -
Run
pulumi upto preview and deploy changes:$ pulumi upPreviewing changes:...Performing changes:...Resources:+ X createdDuration: ... -
Check the deployed website endpoint:
$ pulumi stack output endpointhttps://<identifier>.web.core.windows.net/api/hello$ curl "$(pulumi stack output endpoint)"{"message":"Hello from Spring, Pulumi!"}
Running the App locally#
-
Run Spring Boot application and send a request:
gradle bootRuncurl localhost:8080