本人对activiti6也不是很熟,基本都是自学,基本没有实战过,有些问题很模糊,今天就把一些知识点写出来分享哈,有什么问题大家可以留言大家一起讨论,这篇主要是引入、配置、启动,下篇流程管理
1、版本说明
springboot 2.0.4.RELEASE
activiti6.0.0
2、引入activiti6的pom,,通过springboot starter的方式引入比之前的方式好多了
<activiti.version>6.0.0</activiti.version>
<dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic</artifactId> <version>${activiti.version}</version> </dependency> <!--activiti modeler 5.22 start--> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-json-converter</artifactId> <version>${activiti.version}</version> <exclusions> <exclusion> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-model</artifactId> </exclusion> </exclusions> </dependency> <!-- xml解析依赖--> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-codec</artifactId> <version>${batik.version}</version> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-css</artifactId> <version>${batik.version}</version> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-svg-dom</artifactId> <version>${batik.version}</version> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-svggen</artifactId> <version>${batik.version}</version> </dependency> <!-- xml解析依赖--> <!--activiti modeler 5.22 end-->
3、yml配置和启动类排除
引入完成后,需要添加如下配置,也可以不加
# 解决启动报错:class path resource [processes/] cannot be resolved to URL because it does not exist activiti: check-process-definitions: false # 不检查processes路径下的流程文件 # 检测身份信息表是否存在,这里主要是为了整合当前系统的用户,act_id_user、act_id_group 、act_id_membership db-identity-used: false
需要在启动类排除SecurityAutoConfiguration这个类,不然会报错
4、新建activiti用户视图
act_id_user、act_id_group 、act_id_membership 分别对应流程用户、流程用户组、流程用户和组关系
CREATE VIEW act_id_user AS SELECT u.username AS ID_, 0 AS REV_, u.real_name AS FIRST_, '' AS LAST_, u.email AS EMAIL_, u.password AS PWD_, '' AS PICTURE_ID_ FROM sys_user u; CREATE VIEW act_id_membership AS SELECT (SELECT u.username FROM sys_user u WHERE (u.user_id = ur.user_id)) AS USER_ID_, (SELECT r.role_sign FROM sys_role r WHERE (r.role_id = ur.role_id)) AS GROUP_ID_ FROM sys_user_role ur;
CREATE VIEW act_id_group AS SELECT r.role_sign AS ID_, NULL AS REV_, r.role_name AS NAME_, 'assignment' AS TYPE_ FROM sys_role r; 5、启动
其他的表会在启动的时候自动创建,activiti5有25张表,activiti6新增了两张表