Errorcreatingbeanwithname‘dataSource‘definedinclasspathresou
发布日期:2021-06-21 12:33:36 浏览次数:3 分类:技术文章

本文共 1053 字,大约阅读时间需要 3 分钟。

Error creating bean with name ‘dataSource’ defined in class path resource

这个NT Bug作为一个新人我真的苦,我CNMD

老子一夜凌晨0点到七点就因为这么个diao东西连不上数据库
事情是这样的,IDEA突然无法加载脚手架了
我搜了一下,https://start.aliyun.com/,可以解决
我正好在学springboot的数据库连接部分,老师在这部分建议properties使用yaml格式,因为毕竟springboot官方建议的
然后出现一个很神奇的事情
aliyun的脚手架,默认会在你的application.properties里面,写一大堆友好的东西(微笑)
在这里插入图片描述
而官方那边是不会写任何东西
没错,和我的application.yaml形成了冲突
在这里插入图片描述
服气
毕竟aliyun给我的帮助是,可以有脚手架使用了
只能说自己NT吧
最后还是因为我突然一个奇思妙想,觉得既然properties和yaml功效一样,会不会是冲突了,然后把properties删掉看看,才后知后觉发现的东西
MD,牛批
解决了如下的异常

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver

转载地址:https://blog.csdn.net/m0_56356993/article/details/117408949 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:在整合Springboot+Dubbo时注意不要犯的错误点
下一篇:锁与线程(锁的升级原理)

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年03月30日 08时30分45秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章