先下载源码
Release Flowable 6.7.2 release · flowable/flowable-engine · GitHub
选择zip文件,下载,解压
然后进入E:\flowable-engine-flowable-6.7.2\flowable-engine-flowable-6.7.2\modules
然后这个flowable-ui的文件夹拷贝到一个你自己新建的workflow文件夹里面
然后再idea中导入项目
如果报这个错误
在pom中加入这一部分代码
javax.servlet javax.servlet-api compile
如果报下面的错误,找到57行
spring-boot-starter-tomcat的scope
provided改成compile
然后刷新maven 启动项目
浏览器输入http://localhost:8080/flowable-ui/
账号admin 密码test
接下来,我们要吧flowable-ui集成到自己的springboot项目中
在pom文件添加这些数据
4.0.0
com.dmg
my-flowable-ui
6.7.2
my-flowable-ui
Demo project for Spring Boot
1.8
UTF-8
UTF-8
2.3.7.RELEASE
org.flowable
flowable-ui-parent
6.7.2
org.flowable
flowable-spring-boot-starter-ui-task
org.flowable
flowable-spring-boot-starter-ui-admin
org.flowable
flowable-spring-boot-starter-ui-idm
org.flowable
flowable-spring-boot-starter-ui-modeler
org.springframework.boot
spring-boot-starter-activemq
org.springframework.boot
spring-boot-starter-amqp
org.springframework.kafka
spring-kafka
org.springframework.boot
spring-boot-starter-oauth2-client
org.springframework.boot
spring-boot-starter-oauth2-resource-server
org.springframework.boot
spring-boot-starter-tomcat
compile
org.springframework.boot
spring-boot-devtools
provided
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-configuration-processor
true
org.springframework.boot
spring-boot-properties-migrator
com.h2database
h2
org.postgresql
postgresql
test
org.springframework.boot
spring-boot-starter-test
test
net.javacrumbs.json-unit
json-unit-assertj
test
org.springframework.ldap
spring-ldap-core
test
com.unboundid
unboundid-ldapsdk
test
javax.servlet
javax.servlet-api
compile
mysql
mysql-connector-java
8.0.25
然后把flowable-ui项目的flowable-default.properties文件拿过来
注释端口号,注释h2数据库,并且修改成mysql数据库
自己的数据库要先建一个flowable的名字
主要关注这部分的内容
这是文件内容
#server.port=8080
server.servlet.context-path=/flowable-ui
spring.jmx.unique-names=true
# This is needed to force use of JDK proxies instead of using CGLIB
spring.aop.proxy-target-class=false
spring.aop.auto=false
spring.application.name=flowable-ui
spring.banner.location=classpath:/org/flowable/spring/boot/flowable-banner.txt
# The default domain for generating ObjectNames must be specified. Otherwise when multiple Spring Boot applications start in the same servlet container
# all would be created with the same name (com.zaxxer.hikari:name=dataSource,type=HikariDataSource) for example
spring.jmx.default-domain=${spring.application.name}
#
# SECURITY
#
spring.security.filter.dispatcher-types=REQUEST,FORWARD,ASYNC
# Expose all actuator endpoints to the web
# They are exposed, but only authenticated users can see /info and /health abd users with access-admin can see the others
management.endpoints.web.exposure.include=*
# Full health details should only be displayed when a user is authorized
management.endpoint.health.show-details=when_authorized
# Only users with role access-admin can access full health details
management.endpoint.health.roles=access-admin
# Spring prefixes the roles with ROLE_. However, Flowable does not have that concept yet, so we need to override that with an empty string
flowable.common.app.role-prefix=
#
# SECURITY OAuth2
# Examples are for Keycloak
#
#spring.security.oauth2.resourceserver.jwt.issuer-uri=/auth/realms/
#spring.security.oauth2.client.registration.keycloak.client-id=
#spring.security.oauth2.client.registration.keycloak.client-secret=
#spring.security.oauth2.client.registration.keycloak.client-name=Flowable UI Keycloak
#spring.security.oauth2.client.registration.keycloak.authorization-grant-type=authorization_code
#spring.security.oauth2.client.provider.keycloak.issuer-uri=/auth/realms/
#spring.security.oauth2.client.provider.keycloak.user-name-attribute=preferred_username
#flowable.common.app.security.type=oauth2
#flowable.common.app.security.oauth2.authorities-attribute=groups
#flowable.common.app.security.oauth2.groups-attribute=userGroups
#flowable.common.app.security.oauth2.default-authorities=access-task
#flowable.common.app.security.oauth2.default-groups=flowableUser
#flowable.common.app.security.oauth2.full-name-attribute=name
#flowable.common.app.security.oauth2.email-attribute=email
#
# DATABASE
#
#spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.url=jdbc:h2:~/flowable-db/engine-db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9093;DB_CLOSE_DELAY=-1
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/flowable?serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowable
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowablea
#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLE
#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowable
spring.datasource.username=root
spring.datasource.password=123456
# JNDI CONFIG
# If uncommented, the datasource will be looked up using the configured JNDI name.
# This will have preference over any datasource configuration done below that doesn't use JNDI
#
# Eg for JBoss: java:jboss/datasources/flowableDS
#
#spring.datasource.jndi-name==jdbc/flowableDS
# Set whether the lookup occurs in a J2EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI
# name doesn't already contain it. Default is "true".
#datasource.jndi.resourceRef=true
#
# Connection pool (see https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby)
#
spring.datasource.hikari.poolName=${spring.application.name}
# 10 minutes
spring.datasource.hikari.maxLifetime=600000
# 5 minutes
spring.datasource.hikari.idleTimeout=300000
spring.datasource.hikari.minimumIdle=10
spring.datasource.hikari.maximumPoolSize=50
# test query for H2, MySQL, PostgreSQL and Microsoft SQL Server
#spring.datasource.hikari.connection-test-query=select 1
# test query for Oracle
#spring.datasource.hikari.connection-test-query=SELECT 1 FROM DUAL
# test query for DB2
#spring.datasource.hikari.connection-test-query=SELECT current date FROM sysibm.sysdummy1
#
# Default Task Executor (will be used for @Async)
#
spring.task.execution.pool.core-size=2
spring.task.execution.pool.max-size=50
spring.task.execution.pool.queue-capacity=10000
spring.task.execution.thread-name-prefix=flowable-ui-task-Executor-
#
# Task scheduling
#
spring.task.scheduling.pool.size=5
#
# EMAIL
#
#flowable.mail.server.host=localhost
#flowable.mail.server.port=1025
#flowable.mail.server.username=
#flowable.mail.server.password=
#
# FLOWABLE
#
flowable.process.definition-cache-limit=512
#flowable.dmn.strict-mode=false
flowable.process.async.executor.default-async-job-acquire-wait-time=PT5S
flowable.process.async.executor.default-timer-job-acquire-wait-time=PT5S
flowable.cmmn.async.executor.default-async-job-acquire-wait-time=PT5S
flowable.cmmn.async.executor.default-timer-job-acquire-wait-time=PT5S
# The maximum file upload limit. Set to -1 to set to 'no limit'. Expressed in bytes
spring.servlet.multipart.max-file-size=10MB
# The maximum request size limit. Set to -1 to set to 'no limit'.
# When multiple files can be uploaded this needs to be more than the 'max-file-size'.
spring.servlet.multipart.max-request-size=10MB
# For development purposes, data folder is created inside the sources ./data folder
flowable.content.storage.root-folder=data/
flowable.content.storage.create-root=true
flowable.common.app.idm-admin.user=admin
flowable.common.app.idm-admin.password=test
flowable.experimental.debugger.enabled=false
# Rest API in task application
# If false, disables the rest api in the task app
flowable.task.app.rest-enabled=true
# Configures the way user credentials are verified when doing a REST API call:
# 'any-user' : the user needs to exist and the password need to match. Any user is allowed to do the call (this is the pre 6.3.0 behavior)
# 'verify-privilege' : the user needs to exist, the password needs to match and the user needs to have the 'rest-api' privilege
# If nothing set, defaults to 'verify-privilege'
flowable.rest.app.authentication-mode=verify-privilege
# Enable form field validation after form submission on the engine side
flowable.form-field-validation-enabled=false
# Flowable Admin Properties
# Passwords for rest endpoints and master configs are stored encrypted in the database using AES/CBC/PKCS5PADDING
# It needs a 128-bit initialization vector (http://en.wikipedia.org/wiki/Initialization_vector)
# and a 128-bit secret key represented as 16 ascii characters below
#
# Do note that if these properties are changed after passwords have been saved, all existing passwords
# will not be able to be decrypted and the password would need to be reset in the UI.
flowable.admin.app.security.encryption.credentials-i-v-spec=j8kdO2hejA9lKmm6
flowable.admin.app.security.encryption.credentials-secret-spec=9FGl73ngxcOoJvmL
#flowable.admin.app.security.preemptive-basic-authentication=true
# Flowable IDM Properties
#
# LDAP
#
#flowable.idm.ldap.enabled=true
#flowable.idm.ldap.server=ldap://localhost
#flowable.idm.ldap.port=10389
#flowable.idm.ldap.user=uid=admin, ou=system
#flowable.idm.ldap.password=secret
#flowable.idm.ldap.base-dn=o=flowable
#flowable.idm.ldap.query.user-by-id=(&(objectClass=inetOrgPerson)(uid={0}))
#flowable.idm.ldap.query.user-by-full-name-like=(&(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))
#flowable.idm.ldap.query.all-users=(objectClass=inetOrgPerson)
#flowable.idm.ldap.query.groups-for-user=(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))
#flowable.idm.ldap.query.all-groups=(objectClass=groupOfUniqueNames)
#flowable.idm.ldap.query.group-by-id=(&(objectClass=groupOfUniqueNames)(uniqueId={0}))
#flowable.idm.ldap.attribute.user-id=uid
#flowable.idm.ldap.attribute.first-name=cn
#flowable.idm.ldap.attribute.last-name=sn
#flowable.idm.ldap.attribute.email=mail
#flowable.idm.ldap.attribute.group-id=cn
#flowable.idm.ldap.attribute.group-name=cn
#flowable.idm.ldap.cache.group-size=10000
#flowable.idm.ldap.cache.group-expiration=180000
#
# Keycloak
#
#flowable.idm.app.keycloak.enabled=true
#flowable.idm.app.keycloak.server=
#flowable.idm.app.keycloak.authentication-realm=master
#flowable.idm.app.keycloak.authentication-user=admin
#flowable.idm.app.keycloak.authentication-password=admin
#flowable.idm.app.keycloak.realm=
#
# DEFAULT ADMINISTRATOR ACCOUNT
#
flowable.idm.app.admin.user-id=admin
flowable.idm.app.admin.password=test
flowable.idm.app.admin.first-name=Test
flowable.idm.app.admin.last-name=Administrator
[email protected]
# Enable and configure JMS
#flowable.task.app.jms-enabled=true
#spring.activemq.broker-url=tcp://localhost:61616
# Enable and configure RabbitMQ
#flowable.task.app.rabbit-enabled=true
#spring.rabbitmq.addresses=localhost:5672
#spring.rabbitmq.username=guest
#spring.rabbitmq.password=guest
# Enable and configure Kafka
#flowable.task.app.kafka-enabled=true
#spring.kafka.bootstrap-servers=localhost:9092
然后新建一个目录,下面是我的目录,你可以改动
com.dmg.flowable.ui
然后把FlowableUiApplication和FlowableUiAppEventRegistryCondition
把放入com.dmg.flowable.ui目录下
/* 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 com.dmg.flowable.ui;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Configuration;
public class FlowableUiApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(FlowableUiApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(FlowableUiApplication.class);
}
}
/* 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 com.dmg.flowable.ui;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.boot.autoconfigure.AutoConfigurationImportFilter;
import org.springframework.boot.autoconfigure.AutoConfigurationMetadata;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import java.util.HashMap;
import java.util.Map;
/**
* @author Filip Hrisafov
*/
public class FlowableUiAppEventRegistryCondition extends SpringBootCondition
implements AutoConfigurationImportFilter, BeanFactoryAware, Condition, EnvironmentAware {
// This is deliberately in the flowable-ui-task-app since it is only needed to enable / disable the dependency on the out of the box app
// if the Task UI Spring Boot Starter is used then people need to add the appropriate Kafka, JMS or RabbitMQ for the event registry
protected BeanFactory beanFactory;
protected Environment environment;
@Override
public boolean[] match(String[] autoConfigurationClasses, AutoConfigurationMetadata autoConfigurationMetadata) {
ConditionEvaluationReport report = ConditionEvaluationReport.find(this.beanFactory);
Map conditions = getConditionOutcomes();
ConditionOutcome[] outcomes = getOutcomes(autoConfigurationClasses, conditions);
boolean[] match = new boolean[outcomes.length];
for (int i = 0; i < outcomes.length; i++) {
match[i] = (outcomes[i] == null || outcomes[i].isMatch());
if (!match[i] && outcomes[i] != null) {
logOutcome(autoConfigurationClasses[i], outcomes[i]);
if (report != null) {
report.recordConditionEvaluation(autoConfigurationClasses[i], this, outcomes[i]);
}
}
}
return match;
}
protected Map getConditionOutcomes() {
boolean jmsEnabled = environment.getProperty("flowable.task.app.jms-enabled", Boolean.class, false);
boolean kafkaEnabled = environment.getProperty("flowable.task.app.kafka-enabled", Boolean.class, false);
boolean rabbitEnabled = environment.getProperty("flowable.task.app.rabbit-enabled", Boolean.class, false);
Map conditions = new HashMap<>();
if (!jmsEnabled) {
conditions.put("org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration",
ConditionOutcome.noMatch("Property flowable.task.app.jms-enabled was not set to true")
);
}
if (!kafkaEnabled) {
conditions.put("org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration",
ConditionOutcome.noMatch("Property flowable.task.app.kafka-enabled was not set to true")
);
}
if (!rabbitEnabled) {
conditions.put("org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration",
ConditionOutcome.noMatch("Property flowable.task.app.rabbit-enabled was not set to true")
);
}
return conditions;
}
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
return ConditionOutcome.noMatch(ConditionMessage.empty());
}
protected ConditionOutcome[] getOutcomes(String[] autoConfigurationClasses, Map conditionOutcomes) {
ConditionOutcome[] outcomes = new ConditionOutcome[autoConfigurationClasses.length];
for (int i = 0; i < autoConfigurationClasses.length; i++) {
outcomes[i] = conditionOutcomes.get(autoConfigurationClasses[i]);
}
return outcomes;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
}
然后启动项目,在浏览器输入
http://localhost:8080/flowable-ui
账号admin 密码test
就可以看到界面了
我们可以看下数据库,第一次会创建87张表