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

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.

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

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"; }
}