赞
踩
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依赖没有读取到
- <!-- SpringCloud 微服务 -->
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-dependencies</artifactId>
- <version>${spring-cloud.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
将版本直接写上刷新一下,发现能够读取到bootstartup.yml
<version>Hoxton.SR9</version>
再将版本写回版本统一管理的全局变量中,也能够正常读取
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。