Camunda 创建springboot项目 (一)
Camunda官方文档:
先明确以下对象
RepositoryService : 操作流程定义
RuntimeService : 操作流程实例
TaskService : 操作任务
IdentityService : 操作用户或者组
HistoryService : 查询历史表相关数据
AuthorizationService : 授权相关服务
FormService : 操作流程表单
ManagementService : 执行cmd以及job相关服务
CaseService : CMMN相关操作
FilterService : 过滤相关服务
ExternalTaskService : 外部任务相关服务
DecisionService : DMN相关服务
一 创建项目
填写如下,最后点击Generate Project按钮
二 修改数据库
1 数据库创建Camunda
2 pom文件
只是将H2改为了Mysql
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>springboottest</artifactId> <version>1.0</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.6.4</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-bom</artifactId> <version>7.17.0</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId> </dependency> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId> </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine-plugin-spin</artifactId> </dependency> <dependency> <groupId>org.camunda.spin</groupId> <artifactId>camunda-spin-dataformat-all</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.6.4</version> </plugin> </plugins> </build> </project>
三 application.yml
server: port: 8100 spring: application: name: spring-boot-test jackson: #设置返回前端的参数为驼峰的转换形式 # property-naming-strategy: SNAKE_CASE #日期格式化 date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 # 设置序列化,否则部署时报错(No serializer found for class) serialization: fail-on-empty-beans: false #数据源配置 datasource: url: jdbc:mysql://127.0.0.1:3306/camunda?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&autoReconnectForPools=true&noAccessToProcedureBodies=true&testOnBorrow=true&validationQuery=select 1 driver-class-name: com.mysql.cj.jdbc.Driver username: root password: root camunda: bpm: #配置账户密码来访问Camunda自带的管理界面 admin-user: id: demo password: demo first-name: demo filter: create: All tasks #指定数据库类型 database: type: mysql schema-update: true #禁止自动部署resources下面的bpmn文件 auto-deployment-enabled: true #禁止index跳转到Camunda自带的管理界面,默认true # webapp: # index-redirect-enabled: false
四 启动运行
浏览器输入 localhost:8100
账号 demo
密码 demo