How to set useUnicode=true and characterEncoding=utf8 properties on Spring-managed MySQL JDBC connection

后端 未结 5 646
醉话见心
醉话见心 2021-02-05 06:27

I\'m currently building a Spring MVC webapp and the database is the vital backend part. For whatever reason, however, Spring is refusing to process the data as UTF-8. Since the

5条回答
  •  梦如初夏
    2021-02-05 06:48

    Note that if you are using Spring Boot, you can do this using properties within application.properties instead of having to add extra parameters to your connection strings:

    Put this into application.properties:

    spring.datasource.connectionProperties=useUnicode=true;characterEncoding=utf-8;
    

提交回复
热议问题