flowable 整合springboot后无法找到委派的bean

flowable 整合springboot后无法找到委派的bean

我们在设定监听时,如果是使用了表达式委派的形式来处理一些业务逻辑

如果恰恰你使用了错误的依赖和错误的bean引入就会发生找不到bean的错误

表达式代码如下

delegateExpression="${userTaskAssignee}"

下面引入的依赖是错误的,我们应当引入flowable-spring-boot-starter-process

<dependency>

    <groupId>org.flowable</groupId>

    <artifactId>flowable-spring-boot-starter</artifactId>

    <version>${flowable.version}</version>

</dependency>

如果你使用了多数据源,不应该使用如下代码来实现    

public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {   

@Value("${flowable.mycustom.jdbc-url}")

private String jdbcUrl;

@Value("${flowable.mycustom.username}")

private String username;

@Value("${flowable.mycustom.password}")

private String password;

@Value("${driver-class-name}")

private String driverClassName;

@Bean

    public ProcessEngine getProcessEngine(){

        ProcessEngineConfiguration pec = new StandaloneProcessEngineConfiguration();

        // pec.setDataSource(getDataSource());

        pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

        pec.setAsyncExecutorActivate(false);

        pec.setDatabaseSchemaUpdate("true");

        pec.setIdBlockSize(45);

        pec.setDatabaseSchema("flowable");

        ProcessEngine processEngine = pec.buildProcessEngine();

        return processEngine;

    }

private DataSource getDataSource(){

HikariDataSource dataSource = new HikariDataSource();

dataSource.setJdbcUrl(jdbcUrl);

        dataSource.setUsername(username);

        dataSource.setPassword(password);

        dataSource.setDriverClassName(driverClassName);

return dataSource;

}

您可以尝试使用下面的代码来实现

@Configuration

public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {   

@Value("${flowable.mycustom.jdbc-url}")

private String jdbcUrl;

@Value("${flowable.mycustom.username}")

private String username;

@Value("${flowable.mycustom.password}")

private String password;

@Value("${driver-class-name}")

private String driverClassName;

@Override

    public void configure(SpringProcessEngineConfiguration springProcessEngineConfiguration) {

        springProcessEngineConfiguration.setActivityFontName("宋体");

        springProcessEngineConfiguration.setLabelFontName("宋体");

        springProcessEngineConfiguration.setAnnotationFontName("宋体");

        

        springProcessEngineConfiguration.setDataSource(getDataSource());

        

        springProcessEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

        springProcessEngineConfiguration.setAsyncExecutorActivate(false);

        springProcessEngineConfiguration.setDatabaseSchemaUpdate("true");

        springProcessEngineConfiguration.setIdBlockSize(45);

        springProcessEngineConfiguration.setDatabaseSchema("flowable");

    }

private DataSource getDataSource(){

HikariDataSource dataSource = new HikariDataSource();

dataSource.setJdbcUrl(jdbcUrl);

        dataSource.setUsername(username);

        dataSource.setPassword(password);

        dataSource.setDriverClassName(driverClassName);

return dataSource;

}

}


爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img