SpringBoot 集成 Camunda
- 1 pom.xml
- 2 application.yml
- 3 SQL
- 4 启动
- 5 进入流程页面
1 pom.xml
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xu</groupId>
<artifactId>camunda</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>camunda</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>7.20.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<!-- camunda -->
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>7.20.0</version>
</dependency>
<!-- camunda -->
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>7.20.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.22</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 application.yml
server:
servlet:
context-path: /camunda
port: 8080
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:com/xu/camunda/**/xml/*Mapper.xml
global-config:
banner: false
db-config:
id-type: ASSIGN_ID
table-underline: true
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
call-setters-on-nulls: true
# camunda 配置
camunda:
bpm:
enabled: true
webapp:
application-path: /workflow
admin-user:
id: camunda
password: camunda
first-name: admin
filter:
create: All tasks
database:
type: mysql
schema-update: true
auto-deployment-enabled: true
deployment-resource-pattern: classpath:/processes/*.bpmn
spring:
application:
name: camunda
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/camunda?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 123456
data:
redis:
host: 39.100.122.79
port: 6379
database: 0
password: QNzs@.root_1347908642
3 SQL
camunda 的SQL脚本在camunda 依赖文件中
4 启动
____ _ ____ _ _ __
/ ___| __ _ _ __ ___ _ _ _ __ __| | __ _ | _ \| | __ _| |_ / _| ___ _ __ _ __ ___
| | / _` | '_ ` _ \| | | | '_ \ / _` |/ _` | | |_) | |/ _` | __| |_ / _ \| '__| '_ ` _ \
| |__| (_| | | | | | | |_| | | | | (_| | (_| | | __/| | (_| | |_| _| (_) | | | | | | | |
\____/\__,_|_| |_| |_|\__,_|_| |_|\__,_|\__,_| |_| |_|\__,_|\__|_| \___/|_| |_| |_| |_|
Spring-Boot: (v3.1.5)
Camunda Platform: (v7.20.0)
Camunda Platform Spring Boot Starter: (v7.20.0)
2023-10-31T20:32:59.184+08:00 INFO 11900 --- [ restartedMain] com.xu.camunda.CamundaApplication : Starting CamundaApplication using Java 20.0.1 with PID 11900 (E:\SoureCode\Learn\camunda\target\classes started by xuyq in E:\SoureCode\Learn\camunda)
2023-10-31T20:32:59.191+08:00 INFO 11900 --- [ restartedMain] com.xu.camunda.CamundaApplication : No active profile set, falling back to 1 default profile: "default"
2023-10-31T20:32:59.245+08:00 INFO 11900 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in E:\Maven\Repository\com\sun\xml\bind\jaxb-impl\4.0.3\jaxb-impl-4.0.3.jar referenced one or more files that do not exist: file:/E:/Maven/Repository/com/sun/xml/bind/jaxb-impl/4.0.3/jaxb-core.jar,file:/E:/Maven/Repository/com/sun/xml/bind/jaxb-impl/4.0.3/angus-activation.jar
2023-10-31T20:32:59.245+08:00 INFO 11900 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in E:\Maven\Repository\com\sun\xml\bind\jaxb-core\4.0.3\jaxb-core-4.0.3.jar referenced one or more files that do not exist: file:/E:/Maven/Repository/com/sun/xml/bind/jaxb-core/4.0.3/jakarta.activation-api.jar,file:/E:/Maven/Repository/com/sun/xml/bind/jaxb-core/4.0.3/jakarta.xml.bind-api.jar
2023-10-31T20:32:59.245+08:00 INFO 11900 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in E:\Maven\Repository\org\glassfish\hk2\hk2\3.0.4\hk2-3.0.4.jar referenced one or more files that do not exist: file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/hk2-utils.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/jakarta.annotation-api.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/jakarta.inject-api.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/hk2-api.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/aopalliance-repackaged.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/hk2-core.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/hk2-locator.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/javassist.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/hk2-runlevel.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/class-model.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/asm.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/asm-analysis.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/asm-commons.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/asm-tree.jar,file:/E:/Maven/Repository/org/glassfish/hk2/hk2/3.0.4/asm-util.jar
2023-10-31T20:32:59.245+08:00 INFO 11900 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-10-31T20:32:59.247+08:00 INFO 11900 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-31T20:33:00.137+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-10-31T20:33:00.139+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-10-31T20:33:00.150+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository interfaces.
2023-10-31T20:33:00.163+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-10-31T20:33:00.164+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2023-10-31T20:33:00.172+08:00 INFO 11900 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 0 ms. Found 0 Redis repository interfaces.
2023-10-31T20:33:00.281+08:00 WARN 11900 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.xu.camunda]' package. Please check your configuration.
2023-10-31T20:33:01.035+08:00 INFO 11900 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-10-31T20:33:01.047+08:00 INFO 11900 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-10-31T20:33:01.047+08:00 INFO 11900 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.15]
2023-10-31T20:33:01.119+08:00 INFO 11900 --- [ restartedMain] o.a.c.c.C.[.[localhost].[/camunda] : Initializing Spring embedded WebApplicationContext
2023-10-31T20:33:01.121+08:00 INFO 11900 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1872 ms
2023-10-31T20:33:01.143+08:00 INFO 11900 --- [ restartedMain] .c.b.s.b.s.r.CamundaJerseyResourceConfig : Configuring camunda rest api.
2023-10-31T20:33:01.177+08:00 INFO 11900 --- [ restartedMain] .c.b.s.b.s.r.CamundaJerseyResourceConfig : Finished configuring camunda rest api.
2023-10-31T20:33:01.477+08:00 INFO 11900 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-10-31T20:33:01.641+08:00 INFO 11900 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1ccd9698
2023-10-31T20:33:01.643+08:00 INFO 11900 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-10-31T20:33:01.685+08:00 INFO 11900 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-10-31T20:33:01.774+08:00 INFO 11900 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.2.13.Final
2023-10-31T20:33:01.781+08:00 INFO 11900 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000406: Using bytecode reflection optimizer
2023-10-31T20:33:02.155+08:00 INFO 11900 --- [ restartedMain] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
2023-10-31T20:33:02.465+08:00 INFO 11900 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2023-10-31T20:33:02.469+08:00 INFO 11900 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-10-31T20:33:02.481+08:00 WARN 11900 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-10-31T20:33:02.538+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.spring.boot : STARTER-SB040 Setting up jobExecutor with corePoolSize=3, maxPoolSize:10
2023-10-31T20:33:02.605+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.engine.cfg : ENGINE-12003 Plugin 'CompositeProcessEnginePlugin[genericPropertiesConfiguration, camundaProcessEngineConfiguration, camundaDatasourceConfiguration, camundaJobConfiguration, camundaHistoryConfiguration, camundaMetricsConfiguration, camundaAuthorizationConfiguration, camundaDeploymentConfiguration, CreateAdminUserConfiguration[adminUser=AdminUserProperty[id=camunda, firstName=admin, lastName=Camunda, email=camunda@localhost, password=******]], failedJobConfiguration, CreateFilterConfiguration[filterName=All tasks], eventPublisherPlugin, ApplicationContextClassloaderSwitchPlugin]' activated on process engine 'default'
2023-10-31T20:33:02.608+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.spring.boot : STARTER-SB021 Auto-Deploying resources: []
2023-10-31T20:33:02.610+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-001: Initialized Camunda Spring Boot Eventing Engine Plugin.
2023-10-31T20:33:02.611+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-003: Task events will be published as Spring Events.
2023-10-31T20:33:02.611+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-005: Execution events will be published as Spring Events.
2023-10-31T20:33:02.611+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-009: Listeners will not be invoked if a skipCustomListeners API parameter is set to true by user.
2023-10-31T20:33:02.619+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-007: History events will be published as Spring events.
2023-10-31T20:33:02.912+08:00 INFO 11900 --- [ restartedMain] org.camunda.feel.FeelEngine : Engine created. [value-mapper: CompositeValueMapper(List(org.camunda.feel.impl.JavaValueMapper@2121ece6)), function-provider: org.camunda.bpm.dmn.feel.impl.scala.function.CustomFunctionTransformer@6fa3ac9b, clock: SystemClock, configuration: Configuration(false)]
Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts
Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts
2023-10-31T20:33:04.718+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.connect : CNCT-01004 Discovered provider for connector id 'http-connector' and class 'org.camunda.connect.httpclient.impl.HttpConnectorImpl': 'org.camunda.connect.httpclient.impl.HttpConnectorProviderImpl'
2023-10-31T20:33:04.720+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.connect : CNCT-01004 Discovered provider for connector id 'soap-http-connector' and class 'org.camunda.connect.httpclient.soap.impl.SoapHttpConnectorImpl': 'org.camunda.connect.httpclient.soap.impl.SoapHttpConnectorProviderImpl'
2023-10-31T20:33:04.865+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.engine : ENGINE-00001 Process Engine default created.
2023-10-31T20:33:04.901+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.spring.boot : STARTER-SB011 Skip creating initial Admin User, user does exist: UserEntity[id=camunda, revision=1, firstName=admin, lastName=Camunda, email=camunda@localhost, password=******, salt=******, lockExpirationTime=null, attempts=0]
2023-10-31T20:33:04.913+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.spring.boot : STARTER-SB016 Skip initial filter creation, the filter with this name already exists: All tasks
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Initialization Sequence datacenterId:20 workerId:27
2023-10-31T20:33:05.313+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazyProcessEnginesFilter@73479813
2023-10-31T20:33:05.375+08:00 INFO 11900 --- [ restartedMain] o.c.b.s.b.s.w.f.LazyInitRegistration : lazy initialized org.camunda.bpm.spring.boot.starter.webapp.filter.LazySecurityFilter@2aab11cc
2023-10-31T20:33:05.848+08:00 INFO 11900 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2023-10-31T20:33:05.897+08:00 INFO 11900 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/camunda'
2023-10-31T20:33:05.910+08:00 INFO 11900 --- [ restartedMain] com.xu.camunda.CamundaApplication : Started CamundaApplication in 7.115 seconds (process running for 7.75)
2023-10-31T20:33:05.914+08:00 INFO 11900 --- [ restartedMain] org.camunda.bpm.engine.jobexecutor : ENGINE-14014 Starting up the JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor].
2023-10-31T20:33:05.915+08:00 INFO 11900 --- [ingJobExecutor]] org.camunda.bpm.engine.jobexecutor : ENGINE-14018 JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor] starting to acquire jobs
5 进入流程页面
Camunda 管理页面