spring工程创建:
选择所需的依赖
配置数据库
resources下新建application.yml
server:
port: 8080
spring:
datasource:
name: test
url: jdbc:mysql://localhost:3306/test(你自己的库名)?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: 123456
编译
项目结构
controller
service
ServiceImpl
dao
注意@Mapper的选择
postMan结果