Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring启动api未能启动_Java_Spring Boot - Fatal编程技术网

Java Spring启动api未能启动

Java Spring启动api未能启动,java,spring-boot,Java,Spring Boot,我正在用Postgresql数据库运行我的第一个Spring启动应用程序。我得到以下错误 *************************** APPLICATION FAILED TO START *************************** 说明: 未能配置数据源:无法配置嵌入式数据源 原因:无法确定合适的驱动程序类别 在application.properties中我有 spring.datasource.url=jdbc.postgresql://localhost:543

我正在用Postgresql数据库运行我的第一个Spring启动应用程序。我得到以下错误

***************************
APPLICATION FAILED TO START
***************************
说明:

未能配置数据源:无法配置嵌入式数据源

原因:无法确定合适的驱动程序类别

application.properties中我有

spring.datasource.url=jdbc.postgresql://localhost:5432/Education


什么是我不需要考虑的?

< P>检查PoxGrES驱动程序jar是否是您的Maven或Gealle构建的一部分。缺少的jar可能引起这个问题。

您可以在此处参考更多内容以添加jar:

您只需要在pom.xml中添加以下依赖项

根据错误消息,这是由于缺少postgreSQL驱动程序错误造成的

它将在应用程序中加载postgreSQL的驱动程序

        <!-- PostgreSQL -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
这将对您有所帮助。

更改此选项:

spring.datasource.url=jdbc.postgresql://localhost:5432/Education

为此:

spring.datasource.url=jdbc:postgresql://localhost:5432/Education

您的application.properties文件是这样的吗

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=admin
spring.datasource.initialization-mode=always
spring.datasource.initialize=true
spring.datasource.schema=classpath:/schema.sql
spring.datasource.continue-on-error=true
postgres是否正在本地主机5432上侦听

此外,请确保您具有以下依赖项:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

org.springframework.boot
弹簧靴起动器
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴启动器jdbc
org.postgresql
postgresql
运行时
org.springframework.boot
弹簧起动试验
测试

属性文件中的spring.datasource.url值存在问题。Thanks@user1907849可以
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>