SpringBoot整合Jbpm4(一)

项目源码gitee地址

1. 添加pom.xml配置

`pom.xml文件详细配置

2. 添加jbpm.cfg.xml配置

在resources资源文件目录下添加jbpm.cfg.xml,配置内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
  <process-engine-context>
    <string name="spring.cfg" value="spring-jbpm4.xml" />
  </process-engine-context>
  <import resource="jbpm.default.cfg.xml" />
  <import resource="jbpm.tx.spring.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
  <import resource="jbpm.bpmn.cfg.xml" />
  <import resource="jbpm.identity.cfg.xml" />
  <import resource="jbpm.businesscalendar.cfg.xml" />
  <import resource="jbpm.console.cfg.xml" />
 <!-- <import resource="jbpm.jobexecutor.cfg.xml" />-->
</jbpm-configuration>

3. 添加spring-jbpm.xml配置

在resources资源文件目录下添加spring-jbpm.xml,配置内容:

spring-jbpm.xml

4. 添加logback-spring.xml配置

在resources资源文件目录下添加logback-spring.xml,配置内容:
logback-spring.xml

5. 添加application.properties配置

编码格式
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=UTF-8
sysCode=S002
server.port=8088
server.servlet.context-path=/jbpm-demo
# swagger文档开关
swagger.enable=true
# 默认数据源
spring.datasource.dynamic.primary=master
spring.autoconfigure.exclude[0]=org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/jbpmdb?useUnicode=true&useSSL=false&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.datasource.username=jbpm
spring.datasource.password=jbpm
# druid配置
spring.datasource.druid.stat-view-servlet.enabled=true
spring.datasource.druid.stat-view-servlet.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=Cs654321
spring.datasource.druid.web-stat-filter.enabled=true
spring.datasource.druid.stat-view-servlet.allow=
#mysql pagehelper 分页插件配置
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
# mybatis plus 设置
mybatis-plus.mapper-locations=classpath*:/mappers/**/*.xml
mybatis-plus.type-aliases-package=com.chenxbook.modules.**.dao
#关闭MP3.0自带的banner
mybatis-plus.global-config.banner=false
#默认数据库表下划线命名
mybatis-plus.global-config.db-config.table-underline=true
# 返回类型为Map,显示null对应的字段
mybatis-plus.configuration.call-setters-on-nulls=true
#引用logback.xml
logging.config=classpath:logback-spring.xml

6. 创建项目启动类

package com.chenxbook;


import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.env.Environment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Description
 * <br>  定义项目启动类
 *
 * @author chenxbook
 * @date 2020-02-28
 **/
@Slf4j
@EnableTransactionManagement
@MapperScan(value = {"com.chenxbook.modules.**.dao"})
@ComponentScan(basePackages = {"com.chenxbook.modules"})
@SpringBootApplication
@ImportResource("classpath:spring-jbpm.xml")
public class JbpmDemoApplication {

    public static void main(String[] args) throws UnknownHostException {
        log.info("============spring boot start=================");
        ConfigurableApplicationContext application = SpringApplication.run(JbpmDemoApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application jbpm-demo is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "\n\t" +
                "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
                "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
        log.info("============spring boot end=================");
    }
}

7. 执行数据库脚本

建表语句

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值