springboot集成camunda
超级详细,完全按照操作就行了,代码同步放到github上 mybatis-demo项目里了。
一.步骤:
1. 画bpmn图(看上上一篇官方文档入门版本就知道详细怎么画)
在空白位置点击,就可以给它取名,我取名fang,选择executable
三个流程:
编辑好后,保存,放到resources下:
2.编写对应的java类,都要实现org.camunda.bpm.engine.delegate.JavaDelegate类
import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; public class QDelegate implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) throws Exception { System.out.println("Q技能"); } }
import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; public class WDeletage implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) throws Exception { System.out.println("W技能"); } }
import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; public class EDelegate implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) throws Exception { System.out.println("E技能"); } }
3. 建META-INF 在里面放一个文件processes.xml, 文件为空就行
4. yum配置
需要指定数据库
及配置登录用户名密码
#camunda 配置 camunda: bpm: admin-user: id: demo password: demo first-name: demo filter: create: All tasks
5.pom引入依赖:
<!-- springboot camunda依赖 --> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency>
二. 测试:
1. 启动项目, 能看到lianzhao.bpmn在控制台打印出来了
2.访问:
http://localhost:8080/app/tasklist/default/#/
3. start process
这里没有加变量,直接start
4.看控制台,流程执行了。
完成