Springboot - flowable with dedicated db

Issue Description: Flowable with Spring Boot is not creating tables in the dedicated Flowable_DB schema.

Current setup:

  • There are two application schemas: App1Schema and App2Schema, each with its own transaction manager and EntityManagerFactory.

  • Flowable should use a third schema, Flowable_DB, through a dedicated datasource and transaction manager.

Configuration:

  • Java config:

    • Flowable datasource and transaction manager:

      @Configuration
      public class FlowableDatabaseConfiguration {
      
      @Bean(name = "flowableDataSource")
      @ConfigurationProperties(prefix = "spring.flowable.datasource")
      public DataSource flowableDataSource() {
          return DataSourceBuilder.create().build();
      }
      
      @Bean(name = "flowableTxManager")
      public PlatformTransactionManager flowableTxManager(
              @Qualifier("flowableDataSource") DataSource flowableDataSource) {
          return new DataSourceTransactionManager(flowableDataSource);
      }
      
      
      }
      
    • Flowable engine configuration:

      @Configuration
      public class FlowableEngineConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
      
      @Autowired
      @Qualifier("flowableDataSource")
      private DataSource flowableDataSource;
      
      @Autowired
      @Qualifier("flowableTxManager")
      private PlatformTransactionManager flowableTxManager;
      
      @Override
      public void configure(SpringProcessEngineConfiguration config) {
          config.setDataSource(flowableDataSource);
          config.setTransactionManager(flowableTxManager);
          config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
          config.setJpaEntityManagerFactory(null);
      }
      
      
      }
      
  • YAML configuration:

    spring:
    flowable:
    datasource:
    enabled: true
    jdbcUrl: jdbc:mysql://{URL}/flowable_db?
    username: {username}
    password: {password}
    driver-class-name: com.mysql.cj.jdbc.Driver
    flowable:
    jpa-enabled: false
    idm:
    enabled: false
    cmmn:
    enabled: false
    dmn:
    enabled: false
    form:
    enabled: false

Gradle :
implementation "org.flowable:flowable-spring-boot-starter:7.0.1"

Using springboot 3.5.5

Problem observed:

  • Despite this configuration, Flowable always creates its tables in the primary schema (App1Schema) instead of the dedicated Flowable_DB schema.

  • When adding databaseSchema: flowable_db, Flowable creates all act_* tables in App1Schema and the flw_* tables in Flowable_DB.

The reason why you are seeing this is due to the fact that you are only changing the data source on the process engine.

Can you try changing the EngineConfigurationConfigurer to use the SpringAppEngineConfiguration?

Cheers,
Filip

Thanks @filiphr , below code worked

@Configuration
public class FlowableEngineConfig implements EngineConfigurationConfigurer<SpringAppEngineConfiguration> {

@Autowired
@Qualifier("flowableDataSource")
private DataSource flowableDataSource;

@Autowired
@Qualifier("flowableTxManager")
private PlatformTransactionManager flowableTxManager;

@Override
public void configure(SpringAppEngineConfiguration config) {
config.setDataSource(flowableDataSource);
config.setTransactionManager(flowableTxManager);
config.setDatabaseSchemaUpdate(AppEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
}

}