springboot整合mybatis遇到的问题
-
问题
启动后出现数据库问题
bug提示 java.sql.SQLException: The server time zone value ‘�й���ʱ��’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zo解决方式
mysql-connector-java这个jar包是最新的时候
在application.properties配置文件中配置datasource.url时不能简单的这样配:
spring.datasource.url=jdbc:mysql://localhost:3306/chat
需要加上一些必要的后缀信息(改成下面的配置就可以了):
spring.datasource.url=jdbc:mysql://localhost:3306/chat?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC -
问题 插入数据的时候出现bug
mybatis链接数据库mysql8.0Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL synta解决方式
修改了其中的某个字段名“signal”,居然奇迹般的就不报错了,能正常的运行了,于是突然意识到,这个错误我使用了某个MYSQL的关键字导致的,于是跑到官网去看,真的被我看到使用了此关键字。 -
问题 配置数据源application.properties出现的问题
bug提示 Loading classcom.mysql.jdbc.Driver'. This is deprecated. The new driver class is
com.mysql.cj.jdbc.Driver’. The driver is
automatically registered via the SPI and manual loading of the driver
class is generally unnecessary.解决方式
mysql8.0以上版本的数据库 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mysql8.0以下 spring.datasource.driver-class-name=com.mysql.jdbc.Driver -
问题 配置文件出现spring.datasource.driver-class-name=com.mysql.jdbc.Driver中 mysql.jdbc这几个发红报错**
解决方式
其实这个问题是由于MySQL 这个jar 包依赖类型默认是runtime , 也就是说只有运行时生效,所以虽然这里报错,但是不影响你代码运行。 将runtime 修改为Compile 即可
1 选中项目—> 右键-----> Open Module Settings
2 Modules ------> *****App -------> Dependencies
3 将runtime 修改为Compile即可
问题: IntelliJ Idea解决Could not autowire. No beans of ‘xxxx’ typefound的错误提示
解决方案
降低Autowired检测的级别,将Severity的级别由之前的error改成warning或其它可以忽略的级别。
- 在idea里使用SpringBoot整合MyBatis时遇到的Mapper扫描不到的问题
- 使用idea学习SpringBoot整合Mybatis,遇到mapper无法注入的问题
- Spring boot整合mybatis puls遇到的问题
- spring boot整合mybatis测试时遇到的问题
- IDEA创建一个spring-boot整合Mybatis的模块时,遇到的问题
- spring整合mybatis遇到的问题
- SpringBoot整合MyBatis(多数据源)的org.apache.ibatis.binding.BindingException问题
- Spring boot项目整合mybatis,xml静态资源文件的放置及路径配置问题
- spring ,springMVC,Mybatis和ehcache整合遇到的问题
- springboot与mybatis整合dao层不能注入的问题
- Spring与Mybatis的整合过程中遇到的一些问题
- 记录问题:springboot中使用Mybatis-pagehelper分页插件遇到的版本兼容问题
- Maven项目中,关于Spring Boot 整合MyBatis时,Service层无法找到mapper接口的问题解决
- SpringBoot整合MyBatis MySQL的时区问题
- Spring 整合mybatis时遇到的问题
- springboot多模块化整合mybatis,出现mapper自动注入失败问题
- springmv+mybatis整合以及遇到的问题
- springboot整合Mybatis扫描不到mapper问题
- [小技巧]关于spring boot 整合mybatis-plus: value为null时不返回的问题。
- 使用SpringBoot整合Mybatis时遇到的坑