在文件jdbc.properties文件的jdbc.url的后加上 “?useUnicode=true&characterEncoding=utf-8”
或者没有用到属性文件的,直接在applicationContext.xml中的c3p0连接池配置中
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<default-config>
<property name="driverClass">com.mysql.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf-8</property>
<property name="user">root</property>
<property name="password">123456</property>
<property name="initialPoolSize">5</property>
<property name="maxPoolSize">20</property>
</default-config>
</c3p0-config>