- 我们使用docker拉起一个mysql镜像
$ docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
6552179c3509: Pull complete
d69aa66e4482: Pull complete
3b19465b002b: Pull complete
7b0d0cfe99a1: Pull complete
9ccd5a5c8987: Pull complete
2dab00d7d232: Pull complete
64d3afdccd4a: Pull complete
82148d50b16c: Pull complete
8bb7d73a7d0c: Pull complete
74778cd68a75: Pull complete
d7e5f9309140: Pull complete
f2e376ecd59f: Pull complete
Digest: sha256:92d27b8222bbcf53bc42c70ca7cd1010d6c0527efc61f14980ce77c50932bef4
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest
$ docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
52cbb34d7161301c69084d789415d9b9551c9928b0bdaac5e0463d4898ddc8b9
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
52cbb34d7161 mysql:latest "docker-entrypoint.s…" 4 seconds ago Up 3 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp mysql
- 进入容器内部创建数据库
$ docker exec -it 52cbb34d7161 /bin/bash
root@52cbb34d7161:/# pwd
/
root@52cbb34d7161:/# ls
bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@52cbb34d7161:/# mysql -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 8.0.28 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> create database flowable_demo;
Query OK, 1 row affected (0.03 sec)
- 我们使用spring boot cli来创建一个springboot项目,没有安装可以使用
brew install spring-boot
$ spring init --dependencies=web,mysql springboot-flowable
Using service at https://start.spring.io
- 打开springboot-flowable项目新增
application.yml
文件
spring:
datasource:
url: jdbc:mysql://localhost:3306/flowable_demo?useUnicode=true&characterEncoding=utf8
username: root
password: 123456
driverClassName: com.mysql.cj.jdbc.Driver
flowable:
async-executor-active: true
-
pom坐标引入依赖jar包
<dependency> <groupId>org.flowable</groupId> <artifactId>flowable-spring-boot-starter</artifactId> <version>6.7.2</version> </dependency>
-
启动项目 从日志中就可以看到创建了响应的表和索引
2022-02-10 16:59:10.047 INFO 39580 --- [ main] liquibase.changelog : Foreign key constraint added to ACT_APP_DEPLOYMENT_RESOURCE (DEPLOYMENT_ID_)
2022-02-10 16:59:10.099 INFO 39580 --- [ main] liquibase.changelog : Index ACT_IDX_APP_RSRC_DPL created
2022-02-10 16:59:10.152 INFO 39580 --- [ main] liquibase.changelog : Table ACT_APP_APPDEF created
2022-02-10 16:59:10.260 INFO 39580 --