注意一下导入的版本
4.0.0 org.springframework.boot spring-boot-starter-parent 2.6.7 com.itheima reggie_take_out 1.0-SNAPSHOT 1.8 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-web compile com.baomidou mybatis-plus-boot-starter 3.4.2 org.projectlombok lombok 1.18.20 com.alibaba fastjson 1.2.76 commons-lang commons-lang 2.6 mysql mysql-connector-java runtime com.alibaba druid-spring-boot-starter 1.1.23 org.springframework.boot spring-boot-maven-plugin 2.4.5
导入完之后记得要刷新一下Maven哦~~~
OK,坐标导入好了之后,依次找到 src/main/resources 目录,把里面的application.properties配置文件改成application.yml文件.然后把下面的内容复制进去。
server:
port: 8080
spring:
application:
name: reggie_take_out #应用的名称,可选
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
#数据库名称reggie
url: jdbc:mysql://localhost:3306/reggie?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root #你自己的数据库用户名,默认root
password: root #你自己数据库的连接密码
mybatis-plus:
configuration:
#在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: ASSIGN_ID #主键生成策略



