一、先把环境整明白:准备工作不踩坑
1. 新建 Spring Boot 项目(手残党也能秒懂)
打开你的 IDEA,新建一个 Spring Boot 项目。记得选 Web 模块,毕竟咱后续可能要搞点接口测试啥的。如果用命令行的话,一行命令搞定:
spring init --name=flowable-demo --groupId=com.example --artifactId=flowable-demo --version=2.7.12 --packaging=jar --dependencies=web,mysql,flowable-spring-boot-starter-process flowable-demo
这里重点说下依赖 flowable-spring-boot-starter-process,这可是 Flowable 和 Spring Boot 联姻的关键信物,自带自动配置功能,能让我们少写一大堆繁琐配置。
2. 数据库配置:和 MySQL 做好朋友
咱先给项目找个「仓库」存流程数据。打开 application.properties,加上数据库配置:
spring.datasource.url=jdbc:mysql://localhost:3306/flowable_db?useUnicode