JEECG集成flowable

该文章已生成可运行项目,

一、后端

1、新建子工程 pom.xml引入


<properties>
       <flowable.version>6.5.0</flowable.version>
</properties>

<dependencies>
        <dependency>
            <groupId>org.jeecgframework.boot</groupId>
            <artifactId>jeecg-boot-base-common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-rest</artifactId>
            <version>${flowable.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-log4j2</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-modeler-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-rest</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-task-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-admin-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-ui-idm-conf</artifactId>
            <version>${flowable.version}</version>
        </dependency>
    </dependencies>

2、配置类

2.1 数据库连接

package org.jeecg.modules.oa.flowable;

import javax.sql.DataSource;
import org.flowable.rest.service.api.RestResponseFactory;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.flowable.spring.boot.FlowableSecurityAutoConfiguration;
import org.flowable.ui.common.service.exception.InternalServerErrorException;
import org.flowable.ui.common.service.idm.RemoteIdmService;
import org.flowable.ui.modeler.properties.FlowableModelerAppProperties;
import org.flowable.ui.modeler.rest.app.EditorGroupsResource;
import org.flowable.ui.modeler.rest.app.EditorUsersResource;
import org.flowable.ui.modeler.rest.app.ModelResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
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 com.fasterxml.jackson.databind.ObjectMapper;

import liquibase.Liquibase;
import liquibase.database.Database;
import liquibase.database.DatabaseConnection;
import liquibase.database.DatabaseFactory;
import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;
import liquibase.resource.ClassLoaderResourceAccessor;

@Configuration
@EnableConfigurationProperties({
   
    FlowableModelerAppProperties.class })
@ComponentScan(basePackages = {
   
    "org.flowable.ui.modeler.repository", "org.flowable.ui.modeler.service",
        "org.flowable.ui.common.service", "org.flowable.ui.common.repository", "org.flowable.ui.common.tenant",
        "org.flowable.ui.modeler.rest.app", "org.flowable.rest.service.api",
        "org.flowable.ui.task.service.debugger" }, excludeFilters = {
   
   
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = RemoteIdmService.class),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ModelResource.class),
        @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 = FlowableSecurityAutoConfiguration.class) })
public class FlowableConfiguration implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
   
   

    public static final Logger log = LoggerFactory.getLogger(FlowableConfiguration.class);

    @Value("${spring.datasource.dynamic.datasource.master.url}")
    private String jdbcUrl;

    @Value("${spring.datasource.dynamic.datasource.master.driver-class-name}")
    private String jdbcDriverClassName;

    @Value("${spring.datasource.dynamic.datasource.master.username}")
    private String username;

    @Value("${spring.datasource.dynamic.datasource.master.password}")
    private String password;

    @Override
    public void configure(SpringProcessEngineConfiguration engineConfiguration) {
   
   
        engineConfiguration.setJdbcUrl(jdbcUrl);
        engineConfiguration.setJdbcDriver(jdbcDriverClassName);
        engineConfiguration.setJdbcUsername(username);
        engineConfiguration.setJdbcPassword(password);
        engineConfiguration.setActivityFontName("\u5B8B\u4F53");
        engineConfiguration.setLabelFontName("\u5B8B\u4F53");
    }

    @Autowired
    protected ObjectMapper objectMapper;

    @ConditionalOnMissingBean
    @Bean
    public RestResponseFactory restResponseFactory() {
   
   
        return new RestResponseFactory(objectMapper);
    }

    @Bean
    public Liquibase liquibase(DataSource dataSource) {
   
   
        log.info("Configuring Liquibase");
        Liquibase liquibase = null;
        try 
本文章已经生成可运行项目
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值