1.添加路徑:resources 資源文件夾下創建application.yml文件,該文件與application.properties文件作用一致,但因爲是樹形結構,更有層次感,便於理解,所以很多人都選擇了yml文件.
2.application.yml文件內容(後續持續更新,在此做記錄)
server:
port:8080 #端口號
#servlet:
#context-path: /commodity
spring:
database:
name:test #數據庫名
url:jdbc:mysql://localhost:3306/test?serverTimezone=UTC #url
username:root #數據庫用戶名
password:root #密碼
type: com.alibaba.druid.pool.DruidDataSource #連接池
driver-class-name: com.mysql.jdbc.Driver #數據庫驅動
maxActive: 20 #最大連接數
initialSize: 1 #初始化數量
mvc:
view: #視圖解析器
prefix: /WEB-INF/views/
suffix: .jsp
#resources:
#static-locations: 配置靜態資源文件路徑
mybatis: #mapper文件掃描路徑
mapper-locations: classpath:mappers/*Mapper.xml