Flowable01SpringBoot项目的引入--------------------每天都会更新,自学中

来到这的人想必已经知道flowable的作用以及用途,下面就直接解释如何在springboot中引入flowable并进行一系列的操作。
1、首先引入依赖(根据你的boot版本3选择7,boot2选择6)我这里是boot3

		<dependency>
			<groupId>org.flowable</groupId>
			<artifactId>flowable-spring-boot-starter</artifactId>
			<version>7.0.1</version>
		</dependency>

2、修改配置文件yml,添加内容

flowable:
  # 关闭定时任务JOB
  async-executor-activate: false
  # 在引擎启动时,如果数据库架构与 Flowable 引擎期望的架构不一致,Flowable 会自动更新数据库架构。这包括创建缺失的表和列,以及修改现有的表和列以匹配最新版本
  database-schema-update: true

若是你的数据库是MySQL8(我建议你加上就完事了),则在url上添加&nullCatalogMeansCurrent=true,具体样子如下所示:

url: jdbc:mysql://localhost:3306/stcj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true

3、配置线程池,创建一个类

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * 线程池
 */
@Configuration
public class ThreadPoolConfig {

    @Bean(name = "customThreadPool")
    public ThreadPoolTaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5); // 核心线程数
        executor.setMaxPoolSize(10); // 最大线程数
        executor.setQueueCapacity(25); // 队列容量
        executor.setThreadNamePrefix("CustomThread-"); // 线程名称前缀
        executor.initialize(); // 初始化线程池
        return executor;
    }
    @Bean(name = {"threadPoolTaskExecutor", "applicationTaskExecutor"})
    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5); // 核心线程数
        executor.setMaxPoolSize(10); // 最大线程数
        executor.setQueueCapacity(25); // 队列容量
        executor.setThreadNamePrefix("ThreadPool-"); // 线程名称前缀
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略
        return executor;
    }
}

启动之后我们就会发现数据库中多了60多张表,flowable就是使用这些表完成业务操作的。这样我们项目中就已经初步引入flowable。
第二篇文章介绍这些表具体有什么作用,核心表是那些。可以关注一下本系列,持续追踪一下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值