SpringBoot+flowable-ui集成实战

前言公司最近想要使用flowable作为我们工作流引擎,主要用于各类流程审批上。在网上搜索到了很多有参考意义的文章,但有些实现细节还需要自己去摸索。本文的实战包括:在项目中引入flowable的包可以使用flowable的api;将flowable-ui集成到自己项目里;如何使用flowable-ui创建的流程模型(我们用的是bpmn模型,所以后面的提到的流程都是指bpmn);集成公司的用户认证体系;自动分配flowable集成flowable的集成有两部分:flowable-api与f
摘要由CSDN通过智能技术生成

前言

公司最近想要使用flowable作为我们工作流引擎,主要用于各类流程审批上。在网上搜索到了很多有参考意义的文章,但有些实现细节还需要自己去摸索。本文的实战包括:

  1. 在项目中引入flowable的包可以使用flowable的api;
  2. 将flowable-ui集成到自己项目里;
  3. 如何使用flowable-ui创建的流程模型(我们用的是bpmn模型,所以后面的提到的流程都是指bpmn);
  4. 集成公司的用户认证体系;
  5. 自动分配

sample源码地址: https://github.com/ChangeChe/flowable

flowable集成

flowable的集成有两部分:flowable-api与flowable-ui。flowable-api主要管创建好流程后怎么使用,flowable-ui就是通过页面去编排我们的流程。

jar包引入

这里的是较新的版本6.7.0。因为自身的框架用的是springboot,所以需要引入一个starter。引入的包里有flowable-ui-xxx是flowable-ui需要的包;其他是我们使用flowable-api需要的包。

<properties>
    <flowable.version>6.7.0</flowable.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-spring-boot-starter-process</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-idm-spring-configurator</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-json-converter</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-ui-modeler-rest</artifactId>
        <version>${flowable.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.flowable</groupId>
                <artifactId>flowable-json-converter</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-log4j2</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-ui-modeler-conf</artifactId>
        <version>${flowable.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.flowable</groupId>
                <artifactId>flowable-json-converter</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-ui-idm-conf</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-ui-idm-rest</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-form-engine</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-form-spring</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-form-engine-configurator</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-form-spring-configurator</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-app-engine</artifactId>
        <version>${flowable.version}</version>
    </dependency>
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>4.3.5</version>
        <exclusions>
            <exclusion>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

配置

# flowable配置
flowable.common.app.idm-url = /idm
flowable.modeler.app.rest-enabled = true
flowable.database-schema-update = true
flowable.process.definition-cache-limit = 1
flowable.xml.encoding = UTF-8

# mybatis配置
mybatis.mapper-locations = classpath:/META-INF/modeler-mybatis-mappings/*.xml
mybatis.config-location = classpath:/META-INF/mybatis-config.xml
mybatis.configuration-properties.blobType = BLOB
mybatis.configuration-properties.boolValue = TRUE
mybatis.configuration-properties.prefix = 

Web配置

路由

@Configuration
@EnableConfigurationProperties({FlowableIdmAppProperties.class, FlowableModelerAppProperties.class})
@ComponentScan(basePackages = {
        "org.flowable.ui.idm.conf",
//        "org.flowable.ui.idm.security",
        "org.flowable.ui.idm.service",
        "org.flowable.ui.modeler.repository",
        "org.flowable.ui.modeler.service",
//        "org.flowable.ui.common.filter",
        "org.flowable.ui.common.service",
        "org.flowable.ui.common.repository",
//        "org.flowable.ui.common.security",
        "org.flowable.ui.common.tenant",
        "org.flowable.form"
}, excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = org.flowable.ui.idm.conf.ApplicationConfiguration.class)
})
public class ApplicationConfiguration implements BeanPostProcessor {
    @Bean
    public ServletRegistrationBean apiServlet(ApplicationContext applicationContext) {
        AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();
        dispatcherServletConfiguration.setParent(applicationContext);
        dispatcherServletConfiguration.register(ApiDispatcherServletConfiguration.class);
        DispatcherServlet servlet = new DispatcherServlet(dispatcherServletConfiguration);
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet, "/api/*");
        registrationBean.
  • 12
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 15
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值