-
问题
启动后出现数据库问题
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或其它可以忽略的级别。