首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >应用程序无法在Spring Boot中启动

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

Stack Overflow用户
提问于 2021-10-05 14:58:18
回答 2查看 326关注 0票数 0

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

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

发布于 2021-10-05 15:32:45

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

票数 0
EN

Stack Overflow用户

发布于 2021-10-26 10:30:24

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

代码语言:javascript
复制
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 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69452813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档