【发布时间】:2021-11-25 20:55:54
【问题描述】:
我有默认的弹簧应用程序并抛出此警告并停止工作 没有控制器和服务它只是一个演示应用程序
WARN 9256 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is 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
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
11:00 ERROR 9256 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
【问题讨论】:
-
你能分享你的属性文件吗?
-
您从哪里获得演示应用程序,自述文件是否指定了有关创建数据库的任何内容?看起来您的
application.properties文件没有详细说明数据源,但您的 spring 项目配置为期望一个。 -
属性文件只有 server.local=8080 和我在 spring initializr 中创建的演示应用
-
我的 pom 文件有这个依赖项:spring-boot-starter-data-jpa、spring-boot-starter-web、spring-boot-devtools、spring-boot-starter-test
-
谢谢它只是为了检查 spring 是否在我的工作计算机中工作,我只是删除 spring 数据依赖项并且工作,但是当我必须使用 spring 数据依赖项时,我会检查你告诉我的内容跨度>
标签: java spring spring-boot hibernate spring-mvc