问题|启动Spring Boot报错-4处 @Spring Boot

描述

说明:

  • 工具:IntelliJ IDEA工具
  • 时间:2021.1.10 @艾伦
  • 记录:搭建好Spring Boot框架及基本配置后,启动Spring Boot项目,结果出现许多问题,在此记录下来,方便日后遇到相关问题时,更好的解决
    在这里插入图片描述

问题

问题1:Application failed to start with classpath

错误:

15:41:19.809 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/All_Projects/Blog/Blog_back-IDEA/bolg/target/classes/]
15:41:20.030 [restartedMain] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/D:/All_Projects/Blog/Blog_back-IDEA/bolg/target/classes/]

具体:
在这里插入图片描述
解决:

  • 检查配置文件,发现有错误的冒号,修改即可 低级错误
    在这里插入图片描述

效果:
在这里插入图片描述


问题2:Unable to load authentication plugin ‘caching_sha2_password’

错误:

ERROR 23072 --- [  restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool  : Unable to create initial connections of pool.

java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

具体:
在这里插入图片描述

解决:

参考:https://blog.csdn.net/w605283073/article/details/88096598

  • 更新mysql驱动的jar版本,如:修改为8.0.11版本 版本问题
    在这里插入图片描述

结果:(新问题的解决见→问题3)
在这里插入图片描述


问题3:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone

新问题:

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 zone value if you want to utilize time zone support.

解决:

参考:https://www.pianshen.com/article/3239164549/

  • 在jdbc的连接 url 部分加上 serverTimezone=UTC 时区问题
    在这里插入图片描述

结果:项目启动成功!!!只出现警告
在这里插入图片描述
在这里插入图片描述


警告4:Loading class ‘com.mysql.jdbc.Driver’. This is deprecated

参考:https://blog.csdn.net/weixin_42323802/article/details/82500458

警告-1: 驱动弃用

Loading class `com.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.

具体:
在这里插入图片描述
解决-1:

  • 数据库驱动‘com.mysql.jdbc.Driver’已经被弃用,需使用新的驱动com.mysql.cj.jdbc.Driver’
  • 在jdbc的相关配置中,将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver
    在这里插入图片描述

警告-2: SSL连接

Sun Jan 10 20:49:14 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. 

According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. 

For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. 
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

具体:
在这里插入图片描述
解决-2:

  • 由于新版的mysql会询问是否SSL连接,并返回一个Boolean值
  • 所以需要手动配置true或false,来告知SSL是否连接(如:useSSL=false)
    在这里插入图片描述

结果:警告消失
在这里插入图片描述


小工具推荐

YAML、YML在线编辑器(格式化校验)解析工具

https://www.toolfk.com/tool-format-yaml
在这里插入图片描述


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值