❓实现数据库随代码自动维护,包含建库建表操作自动建库
自动建库
引入依赖
<!-- mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>${mysql.version}</version>
</dependency>
<!-- springboot jdbc框架-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- hutool db-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-db</artifactId>
<version>${hutool.version}</version>
</dependency>
通过监听SpringBoot的生命周期,在Environment准备完毕后调用建库方法
标签:建表,name,flyway,environment,自动,context,schema,public,建库 From: https://www.cnblogs.com/void-cmy/p/17973970