目录
资源
一、创建项目
二、加依赖
三、加配置
四、后端代码集成
五、前端代码集成
六、启动器修改
资源
1. 版本
参考其他博主选择Flowable6.4.1版本
集成Flowable Modeler需要下载源码
下载较慢,下面是我上传的百度云资源
链接:https://pan.baidu.com/s/18y08wUAZclfE9vpcMD2uSA?pwd=ts19
提取码:ts19
--来自百度网盘超级会员V4的分享
一、创建项目
首先打开idea,创建新的project
1处选1.8版本
二、加依赖
修改pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>myflow</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<mysql.driver.version>8.0.16</mysql.driver.version>
<flowable.version>6.4.1</flowable.version>
<mybatis-spring.version>1.3.2</mybatis-spring.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-process</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-rest</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-conf</artifactId>
<version>6.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-logic</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.driver.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.11</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.9</version>
</dependency>
<!-- Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
三、加配置
1.在resources下添加application.properties
application.properties:
注意:如果像我前面那样配置的mysql是8.0以上版本,就要加上cj。如:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
url中填入自己的数据库,username和password中填入自己的数据库的用户名和密码
server.port=8081
server.servlet.context-path = /flow
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/jeecg-boot?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&nullCatalogMeansCurrent=true//填入自己的
spring.datasource.username=xxx
spring.datasource.password=xxxx
mybatis.config-location=classpath:config/mybatis-config.xml
mybatis.mapper-locations=classpath:mapper/*.xml,mapper/*/*.xml,classpath*:mapper/*.xml,classpath:/META-INF/modeler-mybatis-mappings/*.xml
mybatis.configuration-properties.prefix=
mybatis.configuration-properties.blobType=BLOB
mybatis.configuration-properties.boolValue=TRUE
flowable.async-executor-activate=false
flowable.database-schema-update=true
2.在resource文件夹下创建文件夹config,再在config下创建mybatis-config.xml
mybatis-config.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- <!– 打印查询语句 –>-->
<!-- <setting name="logImpl" value="STDOUT_LOGGING" />-->
<!-- 控制全局缓存(二级缓存)-->
<setting name="cacheEnabled" value="true"/>
<setting name="autoMappingUnknownColumnBehavior" value="WARNING"/>
<!-- 延迟加载的全局开关。当开启时,所有关联对象都会延迟加载。默认 false -->
<setting name="lazyLoadingEnabled" value="true"/>
<!-- 当开启时,任何方法的调用都会加载该对象的所有属性。默认 false,可通过select标签的 fetchType来覆盖-->
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- Mybatis 创建具有延迟加载能力的对象所用到的代理工具,默认JAVASSIST -->
<!--<setting name="proxyFactory" value="CGLIB" />-->
<!-- STATEMENT级别的缓存,使一级缓存,只针对当前执行的这一statement有效 -->
<!-- <setting name="localCacheScope" value="STATEMENT"/> -->
<setting name="localCacheScope" value="SESSION"/>
<setting name="jdbcTypeForNull" value="NULL"/>
</settings>
<typeAliases>
<!-- <typeAlias alias="blog" type="com.wuzz.domain.Blog" />-->
</typeAliases>
<!-- <typeHandlers>
<typeHandler handler="com.wuzz.type.MyTypeHandler"></typeHandler>
</typeHandlers>-->
<!-- 对象工厂 -->
<!-- <objectFactory type="com.wuzz.objectfactory.GPObjectFactory">
<property name="wuzz" value="666"/>
</objectFactory>-->
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="helperDialect" value="mysql" />
<property name="offsetAsPageNum" value="false" />
<property name="rowBoundsWithCount" value="false" />
<property name="pageSizeZero" value="true" />
<property name="reasonable" value="false" />
<property name="supportMethodsArguments" value="false" />
<property name="returnPageInfo" value="none" />
</plugin>
</plugins>
</configuration>
3.汉化配置
在resource文件夹下创建文件夹stencilset,里面放汉化文件(汉化文件过长,此处不再粘贴)
可在前文源码中找到
四、后端代码集成
基本上直接粘贴我的源码就行
首先在java下创建文件夹
在文件夹下创建config文件,将AppDispatcherServletConfiguration.java、ApplicationConfiguration.java、DatabaseAutoConfiguration.java、FlowableStencilSetResource.java、ProcessEngineConfig.java粘在config下
在文件夹下创建config文件controller,将FlowableController.java粘到文件夹下
在加载页面时候会调用此文件内的getAccount 接口获取用户信息,由于我们绕过了登陆,因此给个默认的用户 admin
为了不和原文件冲突,所以 @RequestMapping("/login")
五、前端代码集成
在项目中的 resource 文件夹下新建一个 static 文件夹
复制 flowable-ui-modeler-app 包中 resources\static 下所有文件,复制到新建的 static 下
路径:flowable-engine-flowable-6.4.1\modules\flowable-ui-modeler\flowable-ui-modeler-app\src\main\resources\static
注意:由于前文getAccount接口@RequestMapping("/login"),所以要将index.html
六、启动器修改
在mydemo下创建App.java,创建启动器
App.java:
@Import(value = {ApplicationConfiguration.class, AppDispatcherServletConfiguration.class, DatabaseAutoConfiguration.class})
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class App {
public static void main(String[] args){
try { SpringApplication.run(App.class, args);}catch (Exception e){ e.printStackTrace();}
}
}
运行
运行成功后,打开网页http://127.0.0.1:8081/flow/index.html
集成成功,数据库的数据会自动更新