参考:https://blog.csdn.net/iku5200/article/details/82856621
一、配置
1.application.yml
spring:
profiles:
active: dev
2.application-dev.yml
server:
port: 8080
spring:
datasource:
username: root
password: 123456
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
driver-class-name: com.mysql.jdbc.Driver
mybatis:
mapper-locations: classpath:mapping/*Mapper.xml
type-aliases-package: com.example.entity
#showSql
logging:
level:
com:
example:
mapper : debug
server:
port: 8080
----服务器端口,应该是tomcat端口吧,我的是8080,即主机
spring:
datasource:----数据库信息
username: root---数据库用户名
password: 123456----数据库密码
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC----数据库指向
jdbc:mysql://localhost:3306----数据库端口
/springboot----数据库名
?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
driver-class-name: com.mysql.jdbc.Driver----使用jd