簡體   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