springboot整合flowable

本文介绍了如何在Spring Boot项目中整合Flowable工作流引擎,包括选型Spring Boot 2和Flowable 6.4.1,创建Maven工程,配置POM文件和数据源。通过这些步骤,可以轻松实现Flowable与SpringBoot的集成,首次运行时会自动创建所需的工作流数据表。

选型

spring boot2
flowable 6.4.1
postgresql
mybatis
idea

1.创建idea maven工程

spring InInitializr–web(web)/template engines(thymeleaf)/sql(postgresql)–完成

2.配置pom文件

在这里插入图片描述

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flowable/flowable-spring-boot-starter -->
<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-spring-boot-starter</artifactId>
    <version>6.4.1</version>
</dependency>

3.配置数据源

 #debug=true一致;
debug: true
#前置相同的配置项,idea会自动归类
server:
  port: 8080
  servlet:
    context-path: /
#idea中对yml有良好支持,不用直接输入
spring:
  http:
    encoding:
      charset: utf-8
  thymeleaf:
    cache: true
  mvc:
    date-format: yyyy-mm-dd
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/postgres
    username: postgres
    password: postgres

    # 下面为连接池的补充设置,应用到上面所有数据源中
    # 初始化大小,最小,最大
    initial-size: 5
    min-idle: 5
    max-active: 20
    # 配置获取连接等待超时的时间
    max-wait: 60000
    # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
    time-between-eviction-runs-millis: 60000
    # 配置一个连接在池中最小生存的时间,单位是毫秒
    min-evictable-idle-time-millis: 300000
    validation-query: SELECT * FROM tbapplication
    test-while-idle: true
    test-on-borrow: false
    test-on-return: false
    # 打开PSCache,并且指定每个连接上PSCache的大小
    pool-prepared-statements: true
    #   配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
    max-pool-prepared-statement-per-connection-size: 20
    filters: stat,wall
    use-global-data-source-stat: true
    # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
    connect-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
    # 配置监控服务器
    stat-view-servlet:
      login-username: admin
      login-password: 123456
      reset-enable: false
      url-pattern: /druid/*
      # 添加IP白名单
      #allow:
      # 添加IP黑名单,当白名单和黑名单重复时,黑名单优先级更高
      #deny:
    web-stat-filter:
      # 添加过滤规则
      url-pattern: /*
      # 忽略过滤格式
      exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"


  #用来制定哪个配置文件生效,可以区分开发时的环境和上线后的环境。
  #    如果制定的配置文件中的配置值与当前的默认文件中的配置值矛盾时,以制定的配置文件为准。
  #  profiles:
  #    active: dev
  jpa:
    show-sql: true
    properties:
      hibernate:
        temp:
          use_jdbc_metadata_defaults: false
  #    设置json显示的格式化
  jackson:
    serialization: true

flowable:
  async-executor-activate: false

这样操作后,flowable与springBoot的整个就完成了! 个人非常方便!

然后就可以运行了,初次运行时flowable会将自动执行flowable中的初始化脚本完成工作流所需要的数据表的建立,如果指定的数据库中还未创建过flowable的相关数据表的话。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值