• flowable 的ProcessEngine配置


    1 flowable process engine 是通过  flowable.cfg.xml 配置文件配置的。在spring 环境中是使用 flowable-context.xml 配置文件的,

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine() 方法会从 classpath 中寻找配置文件 flowable.cfg.xml 进行创建。

    说明:flowable.cfg.xml 配置文件必须包含一个 ID 为processEngineConfiguration 的bean

    flowable.cfg.xml 配置文件内容如下

    <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="processEngineConfiguration" 
          class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration">
    
        <property name="jdbcUrl" value="jdbc:mysql://196.131.9.62/flow1?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false" />
        <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
        <property name="jdbcUsername" value="root" />
        <property name="jdbcPassword" value="123456" />
    
        <property name="databaseSchemaUpdate" value="true" />
    
        <property name="asyncExecutorActivate" value="false" />
      </bean>
    
    </beans>

    2 将 flowable 与 springboot 集成

    2.1 pom 文件如下

    <?xml version="1.0" encoding="UTF-8"?>
    
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.huitong</groupId>
      <artifactId>flow1</artifactId>
      <version>1.0-SNAPSHOT</version>
      <packaging>war</packaging>
    
      <name>flow1 Maven Webapp</name>
      <url>http://www.example.com</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <flowable.version>6.3.1</flowable.version>
      </properties>
    
      <!-- Inherit defaults from Spring Boot -->
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
      </parent>
    
      <dependencies>
        <dependency>
          <groupId>org.flowable</groupId>
          <artifactId>flowable-spring-boot-starter</artifactId>
          <version>${flowable.version}</version>
        </dependency>
    
    
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    
        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok</artifactId>
          <version>1.18.2</version>
          <scope>provided</scope>
        </dependency>
    
    
      </dependencies>
    
      <build>
        <finalName>flow1</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
          <plugins>
            <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </project>

    2.2 application.yml 配置

    server:
      port: 8060
    
    spring:
      application:
        name: flow
      datasource:
        url: jdbc:mysql://127.0.0.1:3306/flow2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull
        username: root
        password: root123
        hikari:
          minimum-idle: 3
          connection-timeout: 30000
          maximum-pool-size: 50
          idle-timeout: 60000
    flowable:
      #关闭定时任务JOB
      async-executor-activate: false
      database-schema-update: false
      process:
        #
        definition-cache-limit: 100

    2.3 获得常用的 service 类BaseService

    @Service
    public class BaseService {
    
        @Autowired
        @Getter
        private RepositoryService repositoryService;
    
        @Autowired
        @Getter
        private RuntimeService runtimeService;
    
        @Autowired
        @Getter
        private TaskService taskService;
    
        @Autowired
        @Getter
        private IdmIdentityService idmIdentityService;
    
        @Getter
        @Autowired
        private HistoryService historyService;
    
        @Autowired
        @Getter
        private ManagementService managementService;
    
    }
  • 相关阅读:
    文件和网络
    设备支持
    用户界面概述
    介绍
    图形和描画
    应用程序偏好设置
    文本和Web
    人机界面准则:创建优秀的用户界面
    事件处理
    iPhone OS平台:丰富的可能性
  • 原文地址:https://www.cnblogs.com/zhaopengcheng/p/9688120.html
Copyright © 2020-2023  润新知