通过IDEA新建的SpringBoot工程目录的.mvn,mvnw,mvnw.cmd这三个文件是可以删除的。
自动启动热部署
1 添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
2 勾选自动build
file -- settings -- 搜 compile -- 勾选自动build
3 启动运行时也自动编译
ctrl+alt+shift+/ 四个键一起按 -- registry -- 勾选compile.automake.allow.when.app.running -- close
4 在application.yml中设置 spring.devtools.restart.enabled: true。
热部署:IDEA工具失去焦点以后5s开始自动构建 → 即修改完代码5秒后生效
mysql参数配置
spring:
#数据源
datasource:
username: ***
password: ****
url: jdbc:mysql://localhost:3306/***?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
## 最小空闲连接数量
minimum-idle: 5
## 空闲连接存活最大时间,默认600000(10分钟)
idle-timeout: 180000
## 连接池最大连接数,默认是10
maximum-pool-size: 10
## 数据库连接超时时间,默认30秒,即30000
connection-timeout: 30000
connection-test-query: SELECT 1
##此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
max-lifetime: 1800000
springboot 默认使用hikari连接池,号称最好的链接池。