spring boot + flowable bpm 整合

1.环境: idea2020.1.2 + jdk1.8.33 + mysql8.0.29

2.用 idea新建 springboot项目

3.pom.xml

    <properties>
        <java.version>1.8</java.version>
        <flowable.version>6.7.2</flowable.version>
        <spring-boot.version>2.7.4</spring-boot.version>
    </properties> 

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <!-- 添加flowable-ui-modeler核心依赖项-->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-rest</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <!--添加flowable-ui-modeler配置依赖项-->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>

        <!-- 添加flowable-ui依赖 -->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter-ui-modeler</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter-ui-admin</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter-ui-idm</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter-ui-task</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.21</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.21</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.21</version>
        </dependency>
    </dependencies>

4.application.properties

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable_bpmdb?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver

5.application.yml

flowable:
  async-executor-activate: false
  # 1. false: 默认值,Flowable 启动时,对比数据库表中保存的版本,如果不匹配。将抛出异常
  # 2. true: 启动时会对数据库中所有表进行更新操作,如果表存在,不做处理,反之,自动创建表
  # 3. create-drop: 启动时自动创建表,关闭时自动删除表
  # 4. drop-create: 启动时,删除旧表,再创建新表
  database-schema-update: true # 设置为 false,可通过 https://github.com/flowable/flowable-sql 初始化
  db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
  check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
  history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数

6. log4j.properties

log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n

7. 文件目录如图

8.启动 spring boot启动类,启动成功后,去数据库中查看生成了 flowable bpm流程工程的相关表

9. 浏览器访问  http://localhost:8080/flowable-ui  用户名可以在表act_id_user中查询,默认 admin/test

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Cloud 是一个基于 Spring Boot 的开发工具集,它可以帮助开发者快速地构建分布式系统。而 Flowable 是一个基于 BPM(Business Process Management)的开源工作流引擎,它可以用于管理和执行各种类型的业务流程。 将 Spring Cloud 结合 Flowable 作为业务无关的独立服务可以带来以下的好处: 1. 提升系统的可伸缩性:Spring Cloud 提供了一套完善的微服务架构解决方案,可以将系统拆分成多个独立的服务,每个服务只关注自己的业务逻辑。而 Flowable 作为一个独立的服务,可以用于管理和执行各种类型的业务流程,将复杂的业务逻辑分解成可重用的工作流模型,减轻系统的复杂性,提高系统的可伸缩性。 2. 强化业务流程的可跟踪性:Flowable 提供了灵活的流程定义和执行引擎,可以对各种类型的业务流程进行建模和管理。结合 Spring Cloud,可以将业务流程的执行过程与其他微服务进行关联,实现全链路的业务追踪和监控,从而提升系统的可跟踪性和可调试性。 3. 提高系统的可维护性:将 Flowable 作为独立的服务,可以将业务流程与业务逻辑解耦,使得系统更易维护和演化。当业务需求改变时,只需要调整相应的业务流程定义,而无需修改其他微服务的代码。同时,Flowable 提供了流程监控和任务管理等功能,可以帮助开发者更好地管理和维护业务流程。 综上所述,将 Spring Cloud 结合 Flowable 作为业务无关的独立服务能够提升系统的可伸缩性、业务流程的可跟踪性和系统的可维护性。这种架构方案适用于需要处理复杂业务流程的系统,可以帮助开发者快速搭建可扩展和易维护的分布式系统。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值