[Go to site: main page, start]

Skip to main content

Spring Boot Starter

The transact-spring-boot-starter provides Spring Boot auto-configuration for DBOS Transact.

danger

DBOS requires a PostgreSQL database. If a non-PostgreSQL DataSource is provided or auto-detected, startup will throw an IllegalStateException.

Auto-Configured Beans

BeanDescription
DBOSConfigBuilt from dbos.* properties. Declare your own to replace it; use DBOSConfigCustomizer to extend it.
DBOSThe main DBOS instance, injected from DBOSConfig.
DBOSLifecycleSmartLifecycle that calls dbos.launch() on context start and dbos.shutdown() on context stop. Uses DEFAULT_PHASE (Integer.MAX_VALUE), so DBOS starts last (after all other beans) and stops first.
DBOSAspectAOP aspect that intercepts @Workflow and @Step calls on Spring-managed beans.
DBOSWorkflowRegistrarScans all singleton beans after initialization and registers those with @Workflow methods.

All beans are @ConditionalOnMissingBean — declare your own to replace any of them.

Configuration Properties

All properties are in the dbos.* namespace.

Application

PropertyTypeDefaultDescription
dbos.application.nameStringApplication name. Falls back to spring.application.name. One of the two must be set.
dbos.application.versionStringApplication version string used for version management.

Datasource

PropertyTypeDefaultDescription
dbos.datasource.urlStringJDBC URL for the DBOS system database. If unset, DBOS uses the application's primary DataSource bean.
dbos.datasource.usernameStringDatabase username.
dbos.datasource.passwordStringDatabase password.
dbos.datasource.schemaStringdbosSchema for DBOS system tables.
dbos.datasource.migratebooleantrueWhether to run database migrations on startup.

DBOS Conductor

PropertyTypeDefaultDescription
dbos.conductor.keyStringDBOS Conductor API key.
dbos.conductor.domainStringDBOS Conductor domain.

Admin Server

warning

dbos.admin-server.* properties are deprecated since 0.9 and will be removed before 1.0. Use DBOS Conductor instead.

PropertyTypeDefaultDescription
dbos.admin-server.enabledbooleanfalseWhether to enable the admin HTTP server.
dbos.admin-server.portint3001Port for the admin HTTP server.

Other

PropertyTypeDefaultDescription
dbos.executor-idStringUnique executor ID for this instance.
dbos.enable-patchingbooleanfalseEnable workflow patching.
dbos.listen-queuesList<String>[]Queues this executor should dequeue from.
dbos.scheduler-polling-intervalDurationOverride the default scheduler polling interval.
dbos.use-listen-notifybooleantrueWhether to use PostgreSQL LISTEN/NOTIFY for real-time event delivery. Automatically set to false when CockroachDB is detected.

DBOSConfigCustomizer

@FunctionalInterface
public interface DBOSConfigCustomizer {
DBOSConfig customize(DBOSConfig config);
}

Declare one or more DBOSConfigCustomizer beans to modify the auto-configured DBOSConfig without replacing it. Customizers run in @Order / Ordered sequence after the base config is assembled from dbos.* properties.

@Bean
@Order(1)
public DBOSConfigCustomizer myCustomizer() {
return config -> config.withAdminServer(true).withAdminServerPort(8081);
}

DBOSWorkflowRegistrar

Implements SmartInitializingSingleton. After all singletons are created, it scans every bean for methods annotated with @Workflow or @Step. Beans containing @Workflow methods are registered with DBOS for durable execution and recovery. @Step methods are not registered directly — they are intercepted at runtime by DBOSAspect.

Requirements:

  • Beans with @Workflow or @Step methods must be singletons. Prototype-scoped beans throw IllegalStateException.
  • DBOS registers the raw (unwrapped) bean target. Calls made via this inside a workflow body bypass the Spring proxy and are not intercepted by DBOSAspect. Use a self-injected proxy instead (see Spring Boot Integration tutorial)

Multiple beans of the same class:

SituationInstance name
Only one bean of the classnull string (default)
Multiple beans — the @Primary onenull string (default)
Multiple beans — non-primarySpring bean name

@TransactionalStep

Module: dev.dbos:transact-spring-txstep-starter (separate from transact-spring-boot-starter). Package: dev.dbos.transact.spring.txstep.

public @interface TransactionalStep {
String name() default "";
}

Marks a Spring-managed method as a step factory step.

The behaviour depends on calling context:

ContextBehaviour
Inside a @Workflow, not inside a stepFull step factory behaviour: runs in a REQUIRES_NEW transaction, output written to tx_step_outputs atomically with user database work. On workflow retry the recorded output is replayed without re-executing the method body.
Outside a workflow, or inside any step (including another @TransactionalStep)Behaves like @Transactional: runs with PROPAGATION_REQUIRED (joins an existing transaction or starts a new one), no DBOS checkpoint recorded.

The annotated method must be called through a Spring proxy — calls via this bypass the aspect.

Parameters:

  • name: Stable name for this step within the workflow. Defaults to the method name.

Supported stacks: Spring JDBC / JdbcTemplate, JDBI (jdbi3-spring), jOOQ (spring-boot-starter-jooq), JPA / Hibernate.

Installation

build.gradle.kts
implementation("dev.dbos:transact-spring-boot-starter:<version>")
implementation("dev.dbos:transact-spring-txstep-starter:<version>")
pom.xml
<dependency>
<groupId>dev.dbos</groupId>
<artifactId>transact-spring-boot-starter</artifactId>
<version>VERSION</version>
</dependency>
<dependency>
<groupId>dev.dbos</groupId>
<artifactId>transact-spring-txstep-starter</artifactId>
<version>VERSION</version>
</dependency>

Auto-Configured Beans

BeanDescription
TransactionalStepAspectAOP aspect that intercepts @TransactionalStep calls and delegates to TransactionalStepFactory.
TransactionalStepFactoryManages step lifecycle: idempotency check, transaction, and output recording.
TransactionalStepRegistrarScans the Spring context post-startup and calls factory.initialize() (creates tx_step_outputs) only when annotated methods are found — no DB contact for apps that don't use the annotation.

All beans are @ConditionalOnMissingBean.

Configuration

PropertyDefaultDescription
dbos.txstep.schemaDBOS system schemaPostgreSQL schema for the tx_step_outputs table

How it works

  1. TransactionalStepAspect intercepts every @TransactionalStep call and delegates to TransactionalStepFactory.
  2. The factory calls DBOS.runStep(), which checks tx_step_outputs for a prior result. If one exists, it is returned immediately (idempotent replay).
  3. Otherwise, a REQUIRES_NEW Spring transaction is started. The method body runs, and the result is written to tx_step_outputs using DataSourceUtils.getConnection() — the same connection the transaction holds.
  4. The transaction commits, making the user's write and the step output record atomic. If the method throws, the transaction rolls back and the error is recorded separately so retries can replay it.

See the Step Factory tutorial for per-stack examples (JDBC, JDBI, jOOQ, JPA).

DBOSAspect

An @Aspect that intercepts:

  • @Workflow methods — routes the call through dbos.integration().runWorkflow(...) for durable execution and recovery.
  • @Step methods — delegates to dbos.runStep(...) when called inside a workflow context; executes directly otherwise.

Spring AOP intercepts only calls that go through the Spring proxy. this.someStep() calls inside a workflow body are not intercepted. Inject a self-reference to ensure step calls are durable:

@Service
public class MyService {
@Autowired MyService self;

@Workflow
public String myWorkflow() {
return self.myStep(); // intercepted — durable
// this.myStep(); // NOT intercepted — runs outside DBOS
}

@Step
public String myStep() { return "result"; }
}