繁体   English   中英

应用程序无法在 Spring Boot 中启动

[英]APPLICATION FAILED TO START in Spring Boot

我有默认的 spring 应用程序并抛出这个警告并停止工作没有控制器和服务它只是一个演示应用程序



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

如果您有 spring 数据作为依赖项,则需要在 application.properties 文件中指定数据源 url 以连接到数据库。

确保您的application.properties文件中的数据是否正确填写。

spring.datasource.url=jdbc:postgresql://localhost:5432/your_database_name
spring.datasource.username=username
spring.datasource.password=password
spring.jpa.database=postgresql
spring.jpa.hibernate.ddl-auto=update 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM