在application.yml文件中配置数据源时后面跟上编码配置即可。?useUnicode=true&characterEncoding=UTF-8
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/hzxx_shixi?useUnicode=true&characterEncoding=UTF-8
username: root
password: root