flowable入门

flowable入门在使用flowable框架的时候,首先需要引入flowable的jar包,flowablemaven仓库地址为:  org.flowable  flowable-engine  6.0.0.RC1新建flowable.cfg.xml文件,如下图所示:flowable.cfg.xml文件内容如下所示:

大家好,又见面了,我是你们的朋友全栈君。

在使用
flowable框架的时候,首先需要引入
flowable的jar包,flowable maven仓库地址为:

<!– https://mvnrepository.com/artifact/org.flowable/flowable-engine –>
<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-engine</artifactId>
    <version>6.0.0.RC1</version>
</dependency>

新建flowable.cfg.xml文件,如下图所示:

flowable入门

flowable.cfg.xml文件内容如下所示:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   
       http://www.springframework.org/schema/beans/spring-beans.xsd">
       <!--分享牛http://www.shareniu.com/ -->
 <bean id="dataSource"  class="com.alibaba.druid.pool.DruidDataSource">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://127.0.0.1:3306/shareniuflowable?useUnicode=true&characterEncoding=UTF-8
			</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password" value="" />
		<!--  -->
	</bean>
	<!--分享牛http://www.shareniu.com/ -->
        <bean id="processEngineConfiguration"
          class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration" >  
        <property name="dataSource" ref="dataSource" />  
         <property name="databaseSchemaUpdate" value="true" />  
        </bean>  
</beans>

新建测试类如下所示:

package com.shareniu.flowables.ch1;

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;

/**
 * 分享牛http://www.shareniu.com/ 
 *
 */
public class App 
{
	// 获取到Activiti ProcessEngine
		ProcessEngine processEngine = null;
		// 获取RepositoryService 实例对象
		RepositoryService repositoryService = null;
		// 资源名称
		String resourceName = "shareniu_addInputStream.bpmn";
		IdentityService identityService;
		RuntimeService runtimeService;
		TaskService taskService;
		@Before
		public void init() {
			InputStream in = App.class.getClassLoader().getResourceAsStream(
					"com/shareniu/flowables/ch1/flowable.cfg.xml");
			ProcessEngineConfiguration pcf = ProcessEngineConfiguration
					.createProcessEngineConfigurationFromInputStream(in);
			processEngine = pcf.buildProcessEngine();
			repositoryService = processEngine.getRepositoryService();
			identityService = processEngine.getIdentityService();
			runtimeService = processEngine.getRuntimeService();
			taskService = processEngine.getTaskService();
			ProcessEngineConfigurationImpl pc = (ProcessEngineConfigurationImpl) processEngine
					.getProcessEngineConfiguration();
		}
		@Test
		public void addInputStreamTest() throws IOException {
			// 定义的文件信息的流读取 分享牛http://www.shareniu.com/ 
			InputStream inputStream = App.class
					.getClassLoader().getResource("com/shareniu/flowables/ch1/common.bpmn").openStream();
			// 流程定义的分类 分享牛http://www.shareniu.com/ 
			String category = "shareniu_addInputStream";
			// 构造DeploymentBuilder对象
			DeploymentBuilder deploymentBuilder = repositoryService
					.createDeployment().category(category)
					.addInputStream(resourceName, inputStream);
			// 部署
			Deployment deploy = deploymentBuilder.deploy();
			System.out.println(deploy);

		}
		
}

运行上述代码,流程文档以及成功部署。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/143366.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 你的Wi-Fi 还安全吗?全球重大漏洞WPA2 KRACK 详细分析报告

    你的Wi-Fi 还安全吗?全球重大漏洞WPA2 KRACK 详细分析报告近日,Wi-Fi加密协议被曝光存在重大安全漏洞,用于保护Wi-Fi网络安全的WPA2安全加密协议已被黑客破解。这种被称作“Krack”(密钥重装攻击)攻击意味着用户连接的绝大多数Wi-Fi已经不安全了,包括家中的路由器Wi-Fi,都存在被盗号的风险。攻击者可通过此漏洞获取万能密钥来访问WPA2网络,从而窃听用户的通讯信息。究竟这个漏洞是由哪些缺陷引起的?会对用户造成什么影响?作为技术人的我们,又…

    2022年5月4日
    49
  • Excel2JSON Excel转JSON Excel另存为JSON的技巧

    Excel2JSON Excel转JSON Excel另存为JSON的技巧不过欢迎大家转发到微博、微信、朋友圈~么么哒~JSON是码农们常用的数据格式,轻且方便,而直接手敲JSON却是比较麻烦和令人心情崩溃的(因为重复的东西很多),所以很多码农可能会和我一样,选择用Excel去输入数据,然后再想办法转换成JSON格式。小编今天推荐使用Excel直接另存为JSON的方法。该方法的特点是:除可以正常的直接按照表头作为key,内容作为value输出之外,还可以

    2022年6月14日
    25
  • IP地址分类(ABCDE)

    IP地址分类(ABCDE)文章目录 IP 地址分类 ABCDE A B C 三类及特殊 D E 全 0 和全 1 的都保留私有地址 IP 地址分类 ABCDE I 由网络地址和主机地址网络地址 其属于互联网的哪一个网络主机地址 属于该网络中的哪一台主机 IPv4 的长度 32 位 4 字节 A B C 三类及特殊 D E 全 0 和全 1 的都保留 A 1 0 0 0 126 0 0 0 默认子网掩码 255 0 0 0 网络号取

    2025年6月9日
    4
  • Navicat 15 for MySQL 激活码(破解版激活)

    Navicat 15 for MySQL 激活码(破解版激活),https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月16日
    179
  • mysql 添加用户

    mysql 添加用户

    2021年5月5日
    127
  • 碰撞圆周率_我让你背一遍圆周率

    碰撞圆周率_我让你背一遍圆周率#include”stdafx.h”#include<iostream>//碰撞后速度voidtxpz(doublem1,doublem2,double&v1,double&v2){ doublev1_=((m1-m2)*v1+2*m2*v2)/(m1+m2); doublev2_=((m2…

    2025年8月29日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号