码迷,mamicode.com
首页 > 编程语言 > 详细

springboot无法查询到后台的数据

时间:2019-11-12 19:55:33      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:spring   lis   ssl   语句   中文乱码   导致   encoding   from   name   

问题:springbooot中,整合mybatis时,在IUserMapper接口中,

@Select("select * from user where name like ‘%李%‘")
List<User> findUserByName(String name);

@Select的sql语句查不到数据。

 

原因:mysql的url中

application.properties的配置中,

配置了spring.datasource.url=jdbc:mysql://127.0.0.1:3306/spring5

未指定编码,导致中文乱码问题,所以后台就查不到数据了。

解决方法:url中指定字符编码,配置如下:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/spring5?useSSL=true&useUnicode=true&characterEncoding=UTF-8

 

 

 

 

springboot无法查询到后台的数据

标签:spring   lis   ssl   语句   中文乱码   导致   encoding   from   name   

原文地址:https://www.cnblogs.com/mediocreWorld/p/11844601.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!