Springboot 整合 Flowable:使用 flowable-UI 绘制流程图
在Spring Boot中整合Flowable以使用Flowable UI绘制流程图,你需要按照以下步骤操作:
- 添加Flowable UI依赖到你的
pom.xml
文件中:
<dependencies>
<!-- 其他依赖 ... -->
<!-- Flowable UI 依赖 -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-common</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-idm-spring</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-admin</artifactId>
<version>${flowable.version}</version>
</dependency>
</dependencies>
- 配置
application.properties
或application.yml
以连接Flowable引擎:
# 数据源配置
spring.datasource.url=jdbc:mysql://localhost:3306/flowable_ui?useSSL=false
spring.datasource.username=root
spring.datasource.password=example
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# 引擎服务配置
flowable.ui.modeler.enabled=true
flowable.ui.modeler.process-engine-name=default
- 启动类添加
@EnableProcessApplication
注解:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.flowable.spring.boot.FlowableProcessEngineAutoConfiguration;
import org.flowable.spring.boot.FlowableUIApplication;
@SpringBootApplication(exclude = { FlowableProcessEngineAutoConfiguration.class })
@EnableProcessApplication
public class FlowableUiApplication {
public static void main(String[] args) {
SpringApplication.run(FlowableUiApplication.class, args);
}
}
- 配置安全控制,允许访问Flowable UI:
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.anyRequest().perm
评论已关闭