1. 添加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,配置内容:
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=================");
}
}