1.新建SpringBoot项目
1.1通过file->new project,新建项目
1.2.设置项目名称,包名等
1.3.选择web项目和数据库
1.4.点击Next,然后点击Finish完成项目创建,项目结构如下图
2.修改配置文件
项目中生成的配置文件为application.properties,使用起来不够简洁、切勿代码提示,因此,改换application.yml
server:
port: 8080
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/mydb?serverTimezone=GMT%2B8
username: root
password: 1234
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis:
mapper-locations: classpath*:mapper/*.xml
配置文件的设置,包括服务器端口设置,以及访问路径设置等,访问路径设置,只需在server下面添加path: /xxx即可
然后通过spring:datasource 配置数据库信息&#x