| Component | Version |
|---|---|
| Java | 25 LTS (Microsoft Build of OpenJDK) |
| Spring Boot | 4.1.2 |
| Dapr Java SDK | 1.19.0 |
| Dapr runtime / CLI | 1.19.1 |
| Redis | 8.10.3 |
| Zipkin | 3.6.1 |
Use JDK 25, Maven 3.6.3 or later, and Docker Compose v2 or later.
Maven Toolchains automatically selects an installed JDK 25 for compilation and tests,
even when Maven itself uses another JDK. If your JDK 25 is installed in a non-standard
location, set JAVA25_HOME to its installation directory.
For local execution, check that java -version reports Java 25.
The Java container image tracks the latest patch release of Microsoft OpenJDK 25.
State writes omit contentType metadata to keep the existing Redis Hash format,
even when Redis supports JSON. This keeps state reads and writes compatible
without migrating existing counters.
This is a simple sample that receives HTTP communication from outside the company at the Frontend (Spring Boot) and passes it to the BackEnd (Spring Booot). It uses a State Store to maintain state.
+-------------+ +-------------+
| FrontEnd | -----> | BackEnd | --> (StateStore)
+-------------+ +-------------+
Install Dapr CLI 1.19.1.
Install the Dapr CLI | Dapr Docs
Initialize the local Dapr runtime with the version used by this sample.
Docker Compose runs its own sidecars and does not require dapr init.
dapr init --runtime-version 1.19.1Check the installed CLI/runtime versions with dapr --version and the running
Dapr infrastructure containers with docker ps. The Redis and Zipkin versions
in the table above are pinned in docker-compose.yml; dapr init manages its
own infrastructure images.
- Build with
make all - Run
run1.shandrun2.sh, respectively. - State Store uses
redis.
The scripts are as follows, respectively.
frontend
dapr run --app-id frontend --app-port 8080 --dapr-http-port 3500 \
--resources-path ./frontend/components \
-- java -jar frontend/target/frontend-0.0.1-SNAPSHOT.jar com.example.dapr.frontend.FrontEndApplication --server.port=8080
backend
dapr run --app-id backend --app-port 8888 --dapr-http-port 3501 \
--resources-path ./backend/components/dev \
-- java -jar backend/target/backend-0.0.1-SNAPSHOT.jar com.example.dapr.backend.BackEndApplication --server.port=8888
run locally
curl 'http://localhost:8080/test?name=dapr'make all build-local
docker compose up -d
curl 'http://localhost:8080/test?name=dapr'
docker compose down- Set your image names in both
docker-compose.ymlandMakefile, then build withmake all build-local. - For Azure Container Registry, login with
az acr login --name myregistryandmake push.
See the following link on how to do this in containerapps.
Tutorial: Deploy a Dapr application to Azure Container Apps using the Azure CLI | Microsoft Docs
Prepare a BLOB as a State Store and write the account name, key and container in backend\components\storage.yaml. This is used when deploying.
az storage account create \
--name $STORAGE_ACCOUNT \
--resource-group $RESOURCE_GROUP \
--location "$LOCATION" \
--sku Standard_RAGRS \
--kind StorageV2After creating a container environment, deploy it with the following command.
backend
az containerapp create \
--name backend \
--resource-group $RESOURCE_GROUP \
--environment $CONTAINERAPPS_ENVIRONMENT \
--image morisacr.azurecr.io/dapr-sample-backend:latest \
--target-port 8080 \
--ingress 'internal' \
--min-replicas 1 \
--max-replicas 1 \
--enable-dapr \
--dapr-app-port 8080 \
--dapr-app-id backend \
--dapr-components backend/components/production/storage.yaml \
--registry-login-server $ACR_SERVER --registry-username $ACR_USER --registry-password $ACR_PASSWORDfrontend
az containerapp create \
--name frontend \
--resource-group $RESOURCE_GROUP \
--environment $CONTAINERAPPS_ENVIRONMENT \
--image morisacr.azurecr.io/dapr-sample-frontend:latest \
--target-port 8080 \
--ingress 'external' \
--min-replicas 1 \
--max-replicas 1 \
--enable-dapr \
--dapr-app-port 8080 \
--dapr-app-id frontend \
--registry-login-server $ACR_SERVER --registry-username $ACR_USER --registry-password $ACR_PASSWORD