java SpringBoot项目无法连接到PostgreSQL

sc4hvdpw  于 2023-03-28  发布在  Java
关注(0)|答案(1)|浏览(206)

我正在尝试执行一个SpringBoot项目,但是我在运行时遇到了这个问题:

***************************
APPLICATION FAILED TO START
***************************

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

Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

应用程序。属性:

spring.datasource.url=jdbc:postgresql://localhost:5432/aiko
spring.datasource.username=postgres
spring.datasource.password=123
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

聚合物.xml

<dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>

我尝试了一些代码在论坛上阅读,但它没有工作

xqk2d5yq

xqk2d5yq1#

解决方法:

<dependency>
    <groupId>org.hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <scope>runtime</scope>
</dependency>

在pom.xml存档中

相关问题