flowable与spring boot集成

一)只需要在pom.xml配置好以下(加粗部分):


4.0.0

com.zjm
gwork
0.0.1-SNAPSHOT

jar
gwork
gwork project for  Spring Boot


  org.springframework.boot
  spring-boot-starter-parent
  2.0.4.RELEASE
  



  UTF-8
  UTF-8
  1.8
  6.4.1
  5.1.46
  
  
  
  
     org.springframework.boot
     spring-boot-starter-web
     
        
           org.springframework.boot 
           spring-boot-starter-logging
        
    
  
  
  
    
        org.springframework.boot
        spring-boot-starter-log4j2
    
    
  
     org.mybatis.spring.boot
     mybatis-spring-boot-starter
     1.3.2
  
  
     org.springframework.boot
     spring-boot-configuration-processor
     true
  
  
  
     org.flowable
     flowable-spring-boot-starter
     ${flowable.version}
  
  
     mysql
     mysql-connector-java
     ${mysql.version}
  
  
     org.springframework.boot
     spring-boot-starter-test
     test
      
 
        
  
    
        org.springframework.boot
        spring-boot-starter-security
    
    
      io.jsonwebtoken
      jjwt
      0.9.1
    
  
  
  
     com.fasterxml.jackson.core
     jackson-core
  
  
     com.fasterxml.jackson.core
     jackson-databind
  
  
     com.fasterxml.jackson.datatype
     jackson-datatype-joda
  
  
     com.fasterxml.jackson.module
     jackson-module-parameter-names
  
  
  
     com.github.pagehelper
     pagehelper-spring-boot-starter
     1.2.5
  
  
  
     com.alibaba
     druid-spring-boot-starter
     1.1.9
  
  
  
    
       javax.servlet
       javax.servlet-api
       provided
    
    
   
   
       net.bytebuddy
       byte-buddy
   
   
       net.bytebuddy
       byte-buddy-agent
       test
   

  
  
     org.mybatis.generator
     mybatis-generator-maven-plugin
     1.3.7
  

  
  
     org.apache.poi
     poi
     3.17
  
  
     org.apache.poi
     poi-examples
     3.17
  
  
     org.apache.poi
     poi-excelant
     3.17
  
  
     org.apache.poi
      poi-scratchpad
     3.17
  
  
     org.apache.poi
     poi-ooxml
     3.17
  
  
     org.apache.poi
     poi-ooxml-schemas
     3.17
  

  
  
     org.apache.commons
     commons-csv
     1.6
  
  
  
  
     
        org.springframework.boot
        spring-boot-maven-plugin
     
     
        org.mybatis.generator
        mybatis-generator-maven-plugin
        1.3.2
        
           src/main/resources/generatorConfig.xml
           true
           true
        
        
           
              Generate MyBatis Artifacts
              
                 generate
              
           
        
        
           
              org.mybatis.generator
              mybatis-generator-core
              1.3.2
           
        
     

  
  
     
        src/main/java
        
           **/*.xml
        
     
  
  
  

(二)在spring boot主main类中,关掉spring security认证以及配置Mapper接口的扫描:

package com.zjm.gwork;

import javax.servlet.MultipartConfigElement;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

import java.io.File;

@SpringBootApplication
//添加对mapper包扫描
@MapperScan(“com.zjm.gwork.**.mapper”)
//过滤器开关
@ServletComponentScan(“com.zjm.gwork.utils”)
//取消spring security的认证
@EnableAutoConfiguration(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
//开启缓存功能
//@EnableCaching
//启动swagger注解
public class GworkApplication {

public static void main(String[] args) {
SpringApplication.run(GworkApplication.class, args);

}
/**
* 文件上传配置 zhongzk
* @return
*/
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
//单个文件最大
factory.setMaxFileSize(“300MB”); //KB,MB
// 设置总上传数据总大小
factory.setMaxRequestSize(“500MB”);
// 临时文件路径
String tempUrl = System.getProperty(“user.dir”) + File.separator + “bjgwork” + File.separator + “tmp”;
System.out.println(“临时目录:” + tempUrl);
File file = new File(tempUrl);
if (!file.exists()) {
file.mkdirs();
}
factory.setLocation(tempUrl);
return factory.createMultipartConfig();
}
}
(三)application.yml配置好数据库的连接池,如下:

    server:
    port: 7001
    spring:
		datasource:
    	#基本属性
    	url: jdbc:mysql://localhost:3306/gwork?useUnicode=true&characterEncoding=UTF-		8&allowMultiQueries=true&useSSL=false
    	username: root
   		password: root
    #druid相关配置
    druid:
      #监控统计拦截的filters
      filters: stat
      driver-class-name: com.mysql.jdbc.Driver                 
      #配置初始化大小/最小/最大
      initial-size: 2
      min-idle: 2
      max-active: 30
      #获取连接等待超时时间
      max-wait: 60000
      #间隔多久进行一次检测,检测需要关闭的空闲连接
      time-between-eviction-runs-millis: 60000
      #一个连接在池中最小生存的时间
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT 'x'
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
      pool-prepared-statements: false
      max-pool-prepared-statement-per-connection-size: 20


#上传附件的目录设置以及系统一块模板word、excel的存放路径 zhongzk 2019.4.8
#这样做的原因是由于spring boot发布时打包成了jar,所以没有办法往jar中写文件
filepath:
    uploadpath: c:\uploadfile\
    templatepath: c:\templatefile\
mybatis:
#mapper-locations: classpath:mapper/*.xml
mapper-locations: classpath*:com/zjm/gwork/**/mapper/*mapper.xml
#type-aliases-package: com.zjm.gwork.model
type-aliases-package: com.zjm.gwork.**.model
#pagehelper
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
returnPageInfo: check
#flowable 取消spring boot时自动部署resource/processes中的流程文件
flowable:
check-process-definitions: false
#db-identity-used: true
# 自动生成flowable相关表 第一次生成后建议关闭提高运行速度
database-schema-update: true
# 保存历史数据级别设置为full最高级别,便于历史数据的追溯
history-level: full

(四)启动spring boot后自动生成70张数据库表,建议安装JRebel:秒级热更新神器必备。

本项目的真实开发环境是前端node+vue,后端spring boot+mybatis+mysql5.6,采用git版本管理,码云做敏捷开发管理,swagger用于api注释用法文档自动生成。

————————————————
版权声明:本文为CSDN博主「热水钟」的原创文章,遵循CC 4.0 by-sa版权协议.
原文链接:https://blog.csdn.net/zhongzk69/article/details/90735864

你可能感兴趣的:(flowable)