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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • layui弹出层使用「建议收藏」

    layui弹出层使用「建议收藏」一直在用的一个提示层,现在分享给大家,感谢作者贤心//首先引入js文件<scriptsrc=”./layer.js”></script>常用的//提示层layer.msg(‘玩命提示中’)提示后可以继续操作的,这种会显示和拒绝差不多//提示层layer.msg(‘玩命卖萌中’,function(){//关闭后的操作//l…

    2022年6月9日
    32
  • 为知笔记怎么导入文件「建议收藏」

    为知笔记怎么导入文件「建议收藏」方法1:拖动文件到左侧的笔记文件夹方法2、鼠标右键文件,选择发送到—》为知笔记

    2022年8月31日
    4
  • 圆柱体积公式怎么算立方米_长方体计算体积公式

    圆柱体积公式怎么算立方米_长方体计算体积公式想要求圆柱的体积必须要记住圆柱对应的公式,下面小编为大家提供圆柱体积怎么算,希望对大家有所帮助。求圆柱体积的算法求圆柱体积先要求圆基的半径。两个圆都会做,因为它们大小相同。如果你已经知道半径,你可以继续前进。如果你不知道半径,那么你可以用尺子测量圆的最宽部分,然后除以2。这将比测量直径的一半更准确。我们说,这个圆筒的半径是1英寸(2.5厘米)。把它写下来。如果你知道这个圆的直径,就把它分成2个。…

    2026年1月31日
    2
  • ubuntu 自动挂起_ubuntu 的挂起与休眠

    ubuntu 自动挂起_ubuntu 的挂起与休眠待机计算机将目前的运行状态等数据存放在内存 关闭硬盘 外设等设备 进入等待状态 此时内存仍然需要电力维持其数据 但整机耗电很少 恢复时计算机从内存读出数据 回到挂起前的状态 恢复速度较快 一般笔记本在电池无故障且充满的情况下可以支持这种挂起数小时甚至数天 依具体机型有差别 其他名称 Suspend STR SuspendToRAM 挂起 挂起到内存休眠计算机将目前的运行状态等数据存

    2025年10月11日
    4
  • pstack使用和原理[通俗易懂]

    pstack使用和原理[通俗易懂]pstack使用和原理http://www.cnblogs.com/mumuxinfei/p/4366708.html前言:  最近小组在组织深入剖析Nginx>>的读书会,里面作者提到了pstack这个工具.之前写JAVA程序,对jstack这个工具,非常的喜欢,觉得很有用.于是想比较下pstack和jstack的异同.   和jstack一样,psta

    2025年11月15日
    4
  • Xmind快捷键大全(总结)[通俗易懂]

    Xmind快捷键大全(总结)[通俗易懂]在Xmind中,快捷键是可以大大提高绘图效率的存在。掌握常用的快捷键组合,就可以在键盘上运指如飞,快速地进行思维导图的绘制。主要的快捷键类型有四种,分别是:文件(File)、插入(Insert)、编辑(Edit)和查看(View)。文件文件快捷键,指的是对当前文件整体的一个操作,常见的功能有保存、关闭、打开和新建等。插入XMind:支持添加丰富的主题元素,你可以添加标记、标签、超链接、附件、主题链接、笔记等丰富的主题元素来表达复杂的逻辑层次和丰富的想法。编辑【编辑】类型快捷

    2022年6月6日
    66

发表回复

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

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