SpringBoot yml配置數據庫密碼特殊字符報錯問題
一般本地數據庫密碼都比較簡單,而線上的密碼一般相對復雜。 如果配置文件中包含一些特殊符號 @# 之類的啟動就會報錯。
解決方法:將密碼使用單引號括住
spring:
datasource:
username: root
password: '!@t#est'
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf-8