blog

Workflows with Java Spring Boot: Recent Enhancements in the Dapr Integration

Dapr
Oct 1, 2025
 min read
Embed workflows as Spring-managed beans, enable dependency injection of Dapr clients, declarative compensation logic, and component scanning of activities. Streamline local testing by running sidecars without clusters. Reduce boilerplate while enhancing orchestration, rollback patterns, and production readiness.
Mauricio Salatino
table of Content

The Dapr project has long simplified building distributed applications through portable APIs for service invocation, state management, pub/sub, and workflows. For Java developers, the recent enhancements to the Dapr Spring Boot integration mark a significant step forward, enabling a more natural and frictionless development experience while embracing Spring idioms.

This article summarizes the technical highlights from Mauricio Salatino’s recent Dapr Community update on “Workflows with Java Spring Boot,” focusing on the new features that streamline local development, workflow orchestration, and production readiness.

Spring Boot-Native Dapr Support

The new Dapr Spring Boot Starter abstracts away boilerplate setup by automatically wiring dependency injection, configuration, and lifecycle management for Dapr clients. This allows developers to consume Dapr APIs directly within their Spring components, without manual initialization.

Key benefits include:

  • Dependency injection of the Dapr client (DaprClient) and workflow runtime interfaces (DaprWorkflowClient).

  • Component scanning for workflow definitions and activities through the @EnableDaprWorkflows annotation.

  • Seamless context integration, meaning workflow activities and definitions become Spring-managed beans with full access to the application context (repositories, services, configuration, etc.).

This approach aligns perfectly with Spring’s programming model: instead of treating workflows as isolated runtime entities, they are now first-class citizens within the application context.

Local Development with Testcontainers

Running Dapr locally has traditionally required a Kubernetes cluster or manual setup. The new DaprTestcontainers integration eliminates this friction by spinning up a Dapr sidecar alongside your Spring Boot application during local tests.

Benefits include:

  • Cluster-free local development, with workflows and actors running directly in your test harness.

  • Mockable external services, often integrated with Microcks or simple REST mocks, to validate workflow orchestration logic.

  • Improved developer productivity, since testing workflow patterns no longer depends on infrastructure provisioning.

This dramatically lowers the barrier to experimentation with workflow definitions and compensation semantics.

Workflow Made Native to Spring

Defining workflows in Dapr’s Java SDK typically requires implementing the Workflow interface and registering activities. With the Spring Boot integration:

  • Workflows and activities are declared as @Component beans.

  • Activities can inject Spring services (e.g., repositories, external clients).

  • Compensation logic is registered declaratively, enabling rollback of partial execution in failure scenarios.

For example, a debit/credit compensation pattern can be implemented such that if the second debit in a two-step workflow fails, the first debit is automatically compensated with a credit. The compensation helper tracks input parameters, ensuring that rollback applies precisely to affected customers.

These patterns are cataloged in the workflow-patterns-spring-boot repository, providing ready-to-use templates for real-world orchestration needs.

Deployment Flexibility: From Local to Managed

By simply toggling a few Spring properties, developers can seamlessly switch between:

  • Local workflows with embedded Dapr runtime (via Testcontainers).

  • Remote execution on Diagrid Catalyst, a managed Dapr service.

This flexibility ensures that the same application codebase can run unmodified across environments—from local machines to Kubernetes clusters—while preserving observability through Catalyst’s UI. Engineers can inspect workflow instances, filter by status, replay failed executions, and trace activity-level inputs and outputs.

Roadmap: AI and Beyond

The integration roadmap extends beyond workflow primitives. Notably:

  • Spring AI and Dapr Workflows: experiments are underway to combine durable workflow execution with LLM-based agents. Workflows provide the durability and coordination layer around AI-driven decision-making, preventing brittle retries or duplicated tool calls.

  • Extended workflow patterns: additional compensation, saga, and long-running orchestration examples are being consolidated into the SDK.

  • Enhanced testing utilities: mocking, fault injection, and property-driven testing are becoming first-class features.

The recent enhancements to Dapr Spring Boot significantly reduce the friction for Java developers building workflow-enabled microservices. By leveraging Spring idioms—component scanning, dependency injection, local testing with Testcontainers—engineers can focus on orchestration logic rather than infrastructure. Combined with Catalyst’s managed runtime and emerging AI integrations, Dapr workflows on Spring Boot provide an effective foundation for resilient, distributed Java applications.

For further exploration, see:

More blog posts

Dapr
Apr 28, 2025
 min read
April 28, 2025

Dapr meets GitOps: A Guide to Dapr and Argo CD (Part 1)

Define Dapr deployments through Git and automate infrastructure changes with Argo CD

Fernando Rocha
Dapr
Oct 30, 2024
 min read
October 30, 2024

Grace Hopper Celebration 2024 Recap with Diagrid’s Digital Duo

Grit. Heart. Courage. The Diagrid Digital Duo — Cassie and Sam — made their mark at the Grace Hopper Celebration in vibrant Downtown Philadelphia, Pennsylvania.

Cassie Coyle
Dapr
Architecture
News
Jun 15, 2023
 min read
June 15, 2023

Dapr v1.11 Release Highlights

The Dapr maintainers released a new version of Dapr, the distributed application runtime, this week. This post highlights the major new features and changes for the APIs and components in release 1.11.

Marc Duiker

Diagrid newsletter

Signup for the latest Dapr & Diagrid news:
Dapr