02-流程引擎-Flowable-Spring整合Flowable-FlowAble兼容低版本Mysql的办法
·
一、Flowable如何集成Spring
1.1 Flowable集成Spring+SpringMvc
- POM文件添加以下代码
- 6.8.0 使用mybatis 3.5.7即可,可根据自身对应mybatis版本进行更换,如果你没有自己写的插件等功能,建议升级mybatis版本,如果是老项目,建议使用低版本flowable,例如6.7.2
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine</artifactId>
<version>6.8.0</version>
</dependency>
<!-- 6.8.0 使用mybatis 3.5.7即可,可根据自身对应mybatis版本进行更换-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.7</version>
</dependency>
3.注入对应服务类,直接把以下内容复制即可,数据库要自己去替换我的代码
<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">
<!-- 数据源配置 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${baseDataSource.driverClassName}" />
<property name="url" value="${baseDataSource.url}" />
<property name="username" value="${baseDataSource.username}" />
<property name="password" value="${baseDataSource.password}" />
<property name="maxActive" value="${baseDataSource.maxActive}" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="processEngineConfiguration" class="org.flowable.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="asyncExecutorActivate" value="false" />
<property name="activityFontName" value="宋体"/>
<property name="annotationFontName" value="宋体"/>
<property name="labelFontName" value="黑体"/>
</bean>
<bean id="processEngine" class="org.flowable.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration"/>
</bean>
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"/>
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService"/>
</beans>
1.2 Flowable集成SpringBoot
flowable集成SpringBoot的办法可谓是相当简单,只需要引用自动的依赖即可
POM文件添加以下代码
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.8.0</version>
</dependency>
1.3 Flowable如何兼容Mysql5低版本
Flowable不兼容的原因是执行SQL脚本日期等问题导致,可以修改执行SQL的脚本即可,也可跟换执行器的版本,使用以下操作,让其支持低版本
使用liquibase-core 4.5.0版本,以便支持低版本数据库
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.8.0</version>
<exclusions>
<exclusion>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.5.0</version>
</dependency>
更多推荐


所有评论(0)