1、在applycation.yaml中添加:
servlet:
encoding:
charset: UTF-8
force: true
enabled: true
banner:
charset: UTF-8
datasource:
url: jdbc:mysql://${DATASOURCE_URL}:${DATASOURCE_PORT}/${DATASOURCE_DB_NAME}?serverTimezone=UTC&useSSL=true&useAffectedRows=true&allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8
username: ${DATASOURCE_USER_NAME}
2、确定Mysql版本,mySql8.0的默认编码是UTF-8,Mysql版本5.7.6不是UTF-8