Flowable学习笔记一:初识Flowable

0. 简介

当前项目笔记来源于 工作流大合集

1. 创建项目

就是创建一个普通的maven项目

  1. 添加下列依赖
<dependencies>
    <dependency>
      <groupId>org.flowable</groupId>
      <artifactId>flowable-engine</artifactId>
      <version>6.3.0</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.33</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  1. 创建测试类

启动这个代码之后,会自动在数据库当中创建34张表

package net.lesscoding;

import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.junit.Test;

/**
 * @author eleven
 * @date 2023/12/24 20:01
 * @apiNote
 */
public class EngineTest {

    @Test
    public void testProcessEngine() {
        //
        ProcessEngineConfiguration configuration = new StandaloneProcessEngineConfiguration();
        // 配置 相关数据库配置
        configuration.setJdbcDriver("com.mysql.cj.jdbc.Driver");
        configuration.setJdbcPassword("dream");
        configuration.setJdbcUsername("root");
        configuration.setJdbcUrl("jdbc:mysql:///flowable_test?serverTimezone=UTC");
        // 如果数据库没有表结构就自动创建
        configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        // 通过ProcessEngineConfiguration构建ProcessEngine对象
        ProcessEngine processEngine = configuration.buildProcessEngine();

    }
}

这个代码在mysql8.0当中可能会出现下列错误

Caused by: java.sql.SQLSyntaxErrorException (create breakpoint : Table 'flowable_test.act_ge_property' doesn't exist
    at com.mysql.cj.jdbc.exceptions.SOLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.ClientPreparedStatement,executeInternal(ClientPreparedStatement.java:953)
    at com.mysql.cj.jdbc.ClientPreparedStatement,execute(ClientPreparedStatement,java:370) <4 internal lines>

出现这种情况只需要在mysql的连接字符串中添加上nullCatalogMeansCurrent=true,设置为只查当前连接的schema库即可

ProcessEngineConfiguration configuration = new StandaloneProcessEngineConfiguration();
        // 配置 相关数据库配置
        configuration.setJdbcDriver("com.mysql.cj.jdbc.Driver")
                .setJdbcPassword("dream")
                .setJdbcUsername("root")
                .setJdbcUrl("jdbc:mysql:///flowable_test?serverTimezone=UTC&nullCatalogMeansCurrent=true");

相关推荐

  1. Flowable学习笔记Flowable

    2024-04-23 16:02:01       39 阅读
  2. Flowable 笔记

    2024-04-23 16:02:01       43 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-23 16:02:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-23 16:02:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-23 16:02:01       87 阅读
  4. Python语言-面向对象

    2024-04-23 16:02:01       96 阅读

热门阅读

  1. GetManifestResourceStream用法

    2024-04-23 16:02:01       26 阅读
  2. MySQL数据库——18、事务

    2024-04-23 16:02:01       29 阅读
  3. AtomGit 体验

    2024-04-23 16:02:01       36 阅读
  4. Stable Diffusion 本地部署教程

    2024-04-23 16:02:01       32 阅读
  5. PySide6之QEasingCurve.Type

    2024-04-23 16:02:01       30 阅读
  6. Swift常用的第三方库

    2024-04-23 16:02:01       39 阅读
  7. 工作后的自我介绍

    2024-04-23 16:02:01       30 阅读
  8. ATFX:注册邀请码怎么弄?

    2024-04-23 16:02:01       33 阅读
  9. 大数据——Scala 模式匹配

    2024-04-23 16:02:01       28 阅读
  10. 第4章:GO的错误处理机制

    2024-04-23 16:02:01       31 阅读