源码
githup上下载老版本源码https://github.com/flowable/flowable-engine/releases
gitHub:https://github.com/flowable/flowable-engine

flowable的sql文件则需要到官网下载:flowable官网

下载后解压,sql文件在 flowable-6.5.0\database\create\all中,根据需要导入即可,我使用的是mysql,即导入flowable.mysql.all.create.sql文件

flowable-6.5.0 源码目录

开始正题:直接在springboot集成flowable modeler设计器,比自带的更便利好用,使用的版本是springboot2.3.1,flowable6.5.0maven依赖

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.1.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>priv.gitonline</groupId><artifactId>flowable-ui</artifactId><version>1.0</version><name>flowable-ui</name><description>Demo project for Spring Boot</description><properties><java.version>1.8</java.version><flowable.version>6.5.0</flowable.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- flowable 集成依赖 rest,logic,conf --><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-logic</artifactId><version>${flowable.version}</version></dependency><dependency><groupId>org.flowable</groupId><artifactId>flowable-ui-modeler-conf</artifactId><version>${flowable.version}</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency></dependencies>

需要的文件
1.复制源代码 modules\flowable-ui-modeler\flowable-ui-modeler-app\src\main\resources\static文件夹下的所有文件到springboot项目的resources文件夹下
2.复制AppDispatcherServletConfiguration到任意位置

/* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
package priv.gitonline.flowable.ui.config;
import org.flowable.ui.modeler.rest.app.EditorGroupsResource;
import org.flowable.ui.modeler.rest.app.EditorUsersResource;
import org.flowable.ui.modeler.rest.app.StencilSetResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;@Configuration
@ComponentScan(value = { "org.flowable.ui.modeler.rest.app"// 不加载 rest,因为 getAccount 接口需要我们自己实现//,"org.flowable.ui.common.rest"},excludeFilters = {// 移除 EditorUsersResource 与 EditorGroupsResource,因为不使用 IDM 部分@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = EditorUsersResource.class),@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = EditorGroupsResource.class),// 配置文件用自己的@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = StencilSetResource.class),
})
@EnableAsync
public class AppDispatcherServletConfiguration implements WebMvcRegistrations {private static final Logger LOGGER = LoggerFactory.getLogger(AppDispatcherServletConfiguration.class);@Beanpublic SessionLocaleResolver localeResolver() {return new SessionLocaleResolver();}@Beanpublic LocaleChangeInterceptor localeChangeInterceptor() {LOGGER.debug("Configuring localeChangeInterceptor");LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();localeChangeInterceptor.setParamName("language");return localeChangeInterceptor;}@Overridepublic RequestMappingHandlerMapping getRequestMappingHandlerMapping() {LOGGER.debug("Creating requestMappingHandlerMapping");RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();requestMappingHandlerMapping.setUseSuffixPatternMatch(false);requestMappingHandlerMapping.setRemoveSemicolonContent(false);Object[] interceptors = { localeChangeInterceptor() };requestMappingHandlerMapping.setInterceptors(interceptors);return requestMappingHandlerMapping;}
}

3.复制ApplicationConfiguration 到任意位置

/* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package priv.gitonline.flowable.ui.config;import org.flowable.ui.common.service.idm.RemoteIdmService;
import org.flowable.ui.modeler.properties.FlowableModelerAppProperties;
import org.flowable.ui.modeler.servlet.ApiDispatcherServletConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(FlowableModelerAppProperties.class)
@ComponentScan(basePackages = {
//        "org.flowable.ui.modeler.conf", //不引入 conf"org.flowable.ui.modeler.repository","org.flowable.ui.modeler.service",
//        "org.flowable.ui.modeler.security",//授权方面的都不需要
//        "org.flowable.ui.common.conf", // flowable 开发环境内置的数据库连接
//        "org.flowable.ui.common.filter",// IDM 方面的过滤器"org.flowable.ui.common.service","org.flowable.ui.common.repository",
//        "org.flowable.ui.common.security",//授权方面的都不需要"org.flowable.ui.common.tenant" },excludeFilters = {// 移除 RemoteIdmService@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = RemoteIdmService.class)
})
public class ApplicationConfiguration {@Beanpublic ServletRegistrationBean modelerApiServlet(ApplicationContext applicationContext) {AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext();dispatcherServletConfiguration.setParent(applicationContext);dispatcherServletConfiguration.register(ApiDispatcherServletConfiguration.class);DispatcherServlet servlet = new DispatcherServlet(dispatcherServletConfiguration);ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet, "/api/*");registrationBean.setName("Flowable Modeler App API Servlet");registrationBean.setLoadOnStartup(1);registrationBean.setAsyncSupported(true);return registrationBean;}}

4.复制FlowableStencilSetResource 到任意位置

/* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
package priv.gitonline.flowable.ui.config;import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.flowable.ui.common.service.exception.InternalServerErrorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/app")
public class FlowableStencilSetResource {private static final Logger LOGGER = LoggerFactory.getLogger(FlowableStencilSetResource.class);@Autowiredprotected ObjectMapper objectMapper;@GetMapping(value = "/rest/stencil-sets/editor", produces = "application/json")public JsonNode getStencilSetForEditor() {try {JsonNode stencilNode = objectMapper.readTree(this.getClass().getClassLoader().getResourceAsStream("stencilset/stencilset_bpmn.json"));return stencilNode;} catch (Exception e) {LOGGER.error("Error reading bpmn stencil set json", e);throw new InternalServerErrorException("Error reading bpmn stencil set json");}}@GetMapping(value = "/rest/stencil-sets/cmmneditor", produces = "application/json")public JsonNode getCmmnStencilSetForEditor() {try {JsonNode stencilNode = objectMapper.readTree(this.getClass().getClassLoader().getResourceAsStream("stencilset/stencilset_cmmn.json"));return stencilNode;} catch (Exception e) {LOGGER.error("Error reading bpmn stencil set json", e);throw new InternalServerErrorException("Error reading bpmn stencil set json");}}
}

5.复制FlowableController 到任意位置

package priv.gitonline.flowable.ui.config;import org.flowable.ui.common.model.UserRepresentation;
import org.flowable.ui.common.security.DefaultPrivileges;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;import java.util.ArrayList;
import java.util.List;@RestController
@RequestMapping("/login")
public class FlowableController {/*** 获取默认的管理员信息* @return*/@RequestMapping(value = "/rest/account", method = RequestMethod.GET, produces = "application/json")public UserRepresentation getAccount() {UserRepresentation userRepresentation = new UserRepresentation();userRepresentation.setId("admin");userRepresentation.setEmail("admin@flowable.org");userRepresentation.setFullName("Administrator");
//        userRepresentation.setLastName("Administrator");userRepresentation.setFirstName("Administrator");List<String> privileges = new ArrayList<>();privileges.add(DefaultPrivileges.ACCESS_MODELER);privileges.add(DefaultPrivileges.ACCESS_IDM);privileges.add(DefaultPrivileges.ACCESS_ADMIN);privileges.add(DefaultPrivileges.ACCESS_TASK);privileges.add(DefaultPrivileges.ACCESS_REST_API);userRepresentation.setPrivileges(privileges);return userRepresentation;}
}

6.新建包org.flowable.ui.common.security并复制SecurityUtils到包里

/* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
package org.flowable.ui.common.security;import org.flowable.idm.api.User;
import org.flowable.ui.common.model.RemoteUser;
import org.flowable.ui.common.security.FlowableAppUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;import java.util.ArrayList;
import java.util.List;/*** Utility class for Spring Security.*/
public class SecurityUtils {private static User assumeUser;private SecurityUtils() {}/*** Get the login of the current user.*/public static String getCurrentUserId() {User user = getCurrentUserObject();if (user != null) {return user.getId();}return null;}/*** @return the {@link User} object associated with the current logged in user.*/public static User getCurrentUserObject() {if (assumeUser != null) {return assumeUser;}//        User user = null;
//        FlowableAppUser appUser = getCurrentFlowableAppUser();
//        if (appUser != null) {
//            user = appUser.getUserObject();
//        }//自定义用户RemoteUser user = new RemoteUser();user.setId("admin");user.setDisplayName("Administrator");user.setFirstName("Administrator");user.setLastName("Administrator");user.setEmail("admin@flowable.com");user.setPassword("123456");List<String> pris = new ArrayList<>();pris.add(DefaultPrivileges.ACCESS_MODELER);pris.add(DefaultPrivileges.ACCESS_IDM);pris.add(DefaultPrivileges.ACCESS_ADMIN);pris.add(DefaultPrivileges.ACCESS_TASK);pris.add(DefaultPrivileges.ACCESS_REST_API);user.setPrivileges(pris);return user;}public static FlowableAppUser getCurrentFlowableAppUser() {FlowableAppUser user = null;SecurityContext securityContext = SecurityContextHolder.getContext();if (securityContext != null && securityContext.getAuthentication() != null) {Object principal = securityContext.getAuthentication().getPrincipal();if (principal instanceof FlowableAppUser) {user = (FlowableAppUser) principal;}}return user;}public static boolean currentUserHasCapability(String capability) {FlowableAppUser user = getCurrentFlowableAppUser();for (GrantedAuthority grantedAuthority : user.getAuthorities()) {if (capability.equals(grantedAuthority.getAuthority())) {return true;}}return false;}public static void assumeUser(User user) {assumeUser = user;}public static void clearAssumeUser() {assumeUser = null;}}

7.在springboot项目resources下建个文件夹stencilset,把下面链接里的两个文件下载下来拷贝进去
https://github.com/gitonlie/flowable-ui/tree/master/src/main/resources/stencilset8.修改springboot项目resources\static\scripts\configuration\url-config.js

 /* ACCOUNT URLS */getAccountUrl: function () {// return FLOWABLE.CONFIG.contextRoot + '/app/rest/account';return FLOWABLE.CONFIG.contextRoot + '/login/rest/account';},

application.yml配置

#mysql
spring.datasource.url=jdbc:mysql://localhost:3306/flowable_ui?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=ADMIN123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

异常1 :

com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value

解决:在datasource.url后改成:

jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

异常2 :原因为扫描不到flowable自有mapper.xml

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.flowable.ui.modeler.domain.Model.selectModelByParameters

解决:在application.yml中增加mybatis配置

mybatis:mapper-locations: classpath:mapper/*.xml,mapper/*/*.xml,classpath*:mapper/*.xml,classpath:/META-INF/modeler-mybatis-mappings/*.xml#逗号前面的是本项目的mapper.xml位置,逗号后面的是楼主的报错,也就是没有找到(Mapped Statements collection does not contain value for org.flowable.ui.modeler.domain.Model.selectModelByParameters)configuration-properties:prefix:blobType: BLOBboolValue: TRUE

启动
启动后直接访问 localhost:8080 即可

Flowable6.5 之 springboot集成flowable modeler设计器相关推荐

  1. SpringBoot 集成Flowable设计器(Flowable-ui)

    一.项目场景: 提示:使用版本6.7.0 公司使用前后端项目分离,前端使用bpmn插件生成bpmn xml文件,后端解析处理数据.今天主要介绍后端集成flowable设计器的过程中遇到的问题. 如需了 ...

  2. 快速开发工作流_02_集成在线流程设计器

    接上一篇:快速开发工作流_01_简单流程案例https://gblfy.blog.csdn.net/article/details/102881983 文章目录 七.流程设计器 modeler 7.1 ...

  3. 【Flowable】Flowable流程设计器

    Flowable流程设计器有两种实现方式 Eclipse Designer Flowable UI应用 1.Eclipse Designer Flowable提供了名为Flowable Eclipse ...

  4. 快速开发工作流_03_集成在线流程设计器_内置用户免登录

    接上一篇:快速开发工作流_02_集成在线流程设计器 https://gblfy.blog.csdn.net/article/details/103676784 文章目录 八.内置用户免登录 8.1. ...

  5. bpmn-js:vue集成bpmn-js流程设计器并汉化

    最近工作转到工作流模块开发了,需要开发一个流程设计器. 于是就开始接触到bpmn-js,搜索了不少资料,整合demo.现在总结一下如何在vue工程中集成bpmn-js流程设计器. 集成的效果: 目前这 ...

  6. 【工作流引擎】Flowable流程设计器 基于bpmnjs开发的vue组件

    [工作流引擎]Flowable流程设计器 基于bpmnjs开发的vue组件 设计器介绍 集成设计器 设计器介绍 bpmn.js官网 bpmn.js 是一个BPMN2.0渲染工具包和web建模器, 使得 ...

  7. 基于springboot+element ui+vue的java快速开发平台,集成html5工作流设计器,flowable, element ui 表单设计器

    前后端分离.maven多模块开发,方便多人协同开发 后端选型:springboot2 + mybatis + shiro + jwt token + flowable 前端选型:vue + eleme ...

  8. springboot集成flowable创建请假流程实例

    springboot如何集成flowable,如何部署flowable在线编辑器画bpm图以及bpm图的画法,我在上一篇博客中写了,这里直接上代码(源码地址:晚安/flowable_holiday ( ...

  9. Spring Boot2 + Activiti6 集成在线流程设计器 Activiti modoler(3)

    前言 上篇文章介绍了如何在Spring Boot2集成activiti6 接下来,小编会一步一步的介绍如何集成在线设计器 Activiti Modoler 介绍 什么是 Activiti Modole ...

最新文章

  1. 大脑的学习方式如何,机器学习与生物学习的联系将提供「答案」
  2. 学IT技术几个好的网站
  3. Codeforces 1188
  4. how to prepare reading club
  5. [BZOJ4349]最小树形图
  6. 小米申请雷军签名商标获批
  7. 从零开始学前端:伪元素和盒子模型 --- 今天你学习了吗?(CSS:Day13)
  8. linux查看磁盘内存cpu
  9. DOSbox汇编集成环境下的详细设置
  10. HDU-魔咒词典(字符串hash)
  11. 拳皇世界6月13服务器维护,拳皇世界2月8日例行维护 数据互通公告[图]
  12. Silvaco TCAD仿真3——DeckBuild
  13. 数据库时间相减_sql时间相减
  14. html5横向导航菜单代码,css 横向菜单实现代码
  15. 剑指Offer(二):替换空格
  16. 【AI产品】前沿黑科技,安利一款能让你的照片动起来的app
  17. ArcEngine10 ecp 授权
  18. Ubuntu下WIFI不稳定问题
  19. typescript 装饰器
  20. Qtcreator远程调试arm开发板程序指南

热门文章

  1. 2022-2028全球与中国商用空气净化消毒器市场现状及未来发展趋势
  2. Detecting Adversarial Samples Using Influence Functions and Nearest Neighbors
  3. 萌新学Java之渐入佳境一----初识多线程
  4. css中伪类选择器的顺序
  5. 牛客网sql题详解21-30
  6. 慢查询如何优化?(实战慢查询)
  7. Python爬取《流浪地球》豆瓣影评与数据分析
  8. python配置模块的搜索路径和包的导入
  9. 安恒 明御WEB应用防火墙 report.php 任意用户登录漏洞
  10. Severlet的生命周期