Springboot2.0+gradle7.0+activiti6.0 build a background online process editor-table generation

1. Introduction
  Previous project integration activiti used maven to integrate jar packages. Recently, I accidentally came into contact with the gradle project build tool. I feel that the efficiency of introducing dependent build projects, compiling source code, running tests, packaging JARs, etc. is higher than that of maven , A high degree of freedom, it has been used in Android development before, and interested students can learn about it, so this time I will use gradle to build the project.
Second, create the project
  We first build the project to generate the corresponding table, and then integrate the editor.
  1. Create a gradle project
Insert picture description here
Click Next to write the project name and package name, etc., and click Finish to complete. The project is generated as follows:
Insert picture description here
  2. Next, we will configure the build.gradle file and introduce dependencies:

//gradle 自身需求资源库 放头部
buildscript {
    
    
    repositories {
    
    
        maven {
    
     url 'https://maven.aliyun.com/repository/public' }
        mavenCentral()
    }
    dependencies {
    
    
        classpath('org.springframework.boot:spring-boot-gradle-plugin:2.1.1.RELEASE')
    }
}

//插件
plugins {
    
    
    id "java"
    id "war"
}
apply plugin: 'java'
apply plugin: 'idea'
// 使用spring boot 框架
apply plugin: 'org.springframework.boot'
// 使用spring boot的自动依赖管理
apply plugin: 'io.spring.dependency-management'
//版本信息
group 'org.sug'
version '1.0-SNAPSHOT'
//项目中需要的资源仓库
repositories {
    
    
    maven {
    
     url 'https://maven.aliyun.com/repository/public' }
    mavenCentral()
}
//项目中需要的依赖
dependencies {
    
    
    implementation ('org.springframework.boot:spring-boot-starter-web'){
    
    
        exclude group:'org.springframework.security',module:'spring-security-config'
    }
    implementation ('org.activiti:activiti-spring-boot-starter-basic:6.0.0'){
    
    
        exclude group:'org.springframework.boot',module:'spring-boot-starter-actuator'
        exclude group:'org.springframework.boot',module:'spring-boot-starter-web'
        exclude group:'org.springframework.security',module:'spring-security-config'
    }
    implementation ('org.activiti:activiti-json-converter:6.0.0'){
    
    
        exclude group:'org.activiti',module:'activiti-bpmn-model'
        exclude group:'org.springframework.security',module:'spring-security-config'
    }
    implementation 'commons-io:commons-io:2.5'
    implementation ('org.activiti:activiti-modeler:5.23.0'){
    
    
        exclude group:'org.springframework.security',module:'spring-security-config'
    }
    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2'
    implementation 'mysql:mysql-connector-java:8.0.17'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation group: 'junit', name: 'junit', version: '4.11'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

What needs to be noted here is to exclude spring-security, otherwise when we start the project access, we will jump back to the spring-security login page.
  3. Next, create application.yml, simply configure and import the data source:

server:
  port: 8080
  servlet:
    context-path: /actDemo
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/actmanage?autoReconnect=true&characterEncoding=utf8&useSSL=false
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456
  #activiti 配置  
  activiti:
  #自动部署验证设置:true-开启(默认)、false-关闭
    check-process-definitions: false
   # true activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建。(开发时常用) 
   #flase 默认值。activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常。(生产环境常用)
   #可以在创建好表后,将其设置为false
    database-schema-update: true
   #保存历史数据级别设置为full最高级别,便于历史数据的追溯 
    history-level: full

  4. Create a live startup class: ActApplication

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class ActApplication {
    
    
    public static void main(String[] args) {
    
    
        SpringApplication.run(ActApplication.class,args);
    }
}

&emps;&emps;5. Start generating the tables required by activiti, a total of 28:
Insert picture description here
At this point, the generation of tables is over, you can change database-schema-update: true to false.

Guess you like

Origin blog.csdn.net/code_ang/article/details/114998582