Category
blog
Date
Oct 1, 2025
Author
Mauricio Salatino
table of Content

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

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.

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
Jul 10, 2025
 min read
July 10, 2025

Building Production-Ready AI Agents: What Your Framework Needs

LLMs fall short in real-world business applications due to limitations in direction, memory, real-world access, and domain depth. Agents layer instruction management, memory handling, tool integration, and domain specialization on top of LLMs to help developers build scalable, production-ready agentic systems without sacrificing flexibility or operational control.

Bilgin Ibryam
Dapr
Architecture
Tutorials
Conductor
Jul 1, 2024
 min read
July 1, 2024

Mastering the Dapr Inner Development Loop - Part 2: Run & Validate Apps Locally

There is nothing more satisfying than seeing your development work come together. In part 2 of this blog we'll explore how to run a Dapr app locally to validate functionality.

Bilgin Ibryam
Dapr
Mar 14, 2025
2
 min read
March 14, 2025

The State of Dapr 2025 Report

A comprehensive look into the evolution of Dapr and its impact on modern application development. Whether evaluating Dapr or looking to optimize an existing deployment, this report provides the data and context needed to make informed decisions.

Marc Duiker

Diagrid newsletter

Signup for the latest Dapr & Diagrid news:
Dapr