欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

flowable工作流

程序员文章站 2022-07-04 20:29:01
...

1、 什么是Flowable?

如果你对工作流引擎有所了解,那么一定知道Java领域当前主流的工作流引擎无非就是Jboss旗下的JBPM和Alfresco旗下的Activiti。

Flowable是Activiti原班主创人员从Activiti分离出来的一套工作流引擎,是一个业务流程管理(BPM)和工作流系统,适用于开发人员和系统管理员。其核心是超快速、稳定的BPMN2流程引擎,易于与 Spring集成使用。

2.eclispe测试Flowable(maven项目)

2.1 工程目录

flowable工作流

2.2 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.zjgt</groupId>
	<artifactId>flowable</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>flowable Maven Webapp</name>
	<url>http://maven.apache.org</url>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
		</dependency>
		<!-- 导入Mysql数据库链接jar包 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.30</version>
		</dependency>

		<!-- flowable工作流 -->
		<dependency>
			<groupId>org.flowable</groupId>
			<artifactId>flowable-spring</artifactId>
			<version>6.2.0</version>
		</dependency>
		<!-- alibaba 连接池 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>druid</artifactId>
			<version>1.1.5</version>
		</dependency>


	</dependencies>

	<build>
		<finalName>flowable</finalName>
		<resources>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/*.xml</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>**/*</include>
				</includes>
			</resource>
		</resources>
	</build>


</project>
2.3 FlowableTest.java


package com.cesat;

import java.io.IOException;
import java.io.InputStream;

import org.flowable.engine.IdentityService;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentBuilder;
import org.junit.Before;
import org.junit.Test;

public class FlowableTest {

	// 获取到flowable ProcessEngine
	ProcessEngine processEngine = null;
	// 获取RepositoryService 实例对象
	RepositoryService repositoryService = null;
	// 资源名称
	String resourceName = "leaveProcess.bpmn";

	@Test
	public void init() {

		ProcessEngineConfiguration conf = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
		// 设置数据源信息
		conf.setJdbcDriver("com.mysql.jdbc.Driver");
		conf.setJdbcUrl("jdbc:mysql://localhost:3306/flowable_db");
		conf.setJdbcUsername("root");
		conf.setJdbcPassword("123456");
		// 设置自动建表
		conf.setDatabaseSchemaUpdate("true");
		// 创建一个流程引擎对象,在创建流程引擎对象过程中会自动建表
		ProcessEngine processEngine = conf.buildProcessEngine();
	}

}
2.3鼠标右键选择RunAS-->Junit Test 即可执行 可在navcat里面查看已经创建好的数据库

flowable工作流










相关标签: flowable