当前位置:   article > 正文

Error creating bean with name ‘dataSource‘ defined in class path resource [org/springframework/boot_error creating bean with name 'datasource' defined

error creating bean with name 'datasource' defined in class path resource

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 org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

 由于yml文件命名为了bootstartup.yml,所以springboot没有检测加载,将文件名称改为application.yml就可以了

后续:

由于创建的是springCloud项目,上网查询说bootstrap 加载优先于 applicaton,建议使用bootstartup.yml,然后又进行搜索,最后发现可能是spring-cloud-dependencies依赖没有读取到

  1. <!-- SpringCloud 微服务 -->
  2. <dependency>
  3. <groupId>org.springframework.cloud</groupId>
  4. <artifactId>spring-cloud-dependencies</artifactId>
  5. <version>${spring-cloud.version}</version>
  6. <type>pom</type>
  7. <scope>import</scope>
  8. </dependency>

将版本直接写上刷新一下,发现能够读取到bootstartup.yml

         <version>Hoxton.SR9</version>

再将版本写回版本统一管理的全局变量中,也能够正常读取

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/559649
推荐阅读
相关标签
  

闽ICP备14008679号