我正在尝试使用简单的Spring Boot应用程序。我在启动ApplicationContext上的应用程序时遇到问题。
我使用Eclipse Photon JDK8 Maven的4.0 春天1.5.16
Pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0
<VirtualHost *:80>
DocumentRoot "/var/www/html/public"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_headers.c>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "Content-Type, Token"
</IfModule>
<Directory "/var/www/html/public">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^ - [R=204,L]
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
PrefileApplication.java
打包org.famy;
导入org.springframework.boot.SpringApplication; 导入org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication 公共类PrifileApplication {
<groupId>org.fam</groupId>
<artifactId>Prifile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Prifile</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.16.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
}
Prefile.java
答案 0 :(得分:0)
错误是: org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org / springframework / boot / autoconfigure / orm / jpa / HibernateJpaAutoConfiguration.class]中定义的名称为'entityManagerFactory'的bean时出错:调用init方法失败;嵌套的异常是org.hibernate.service.spi.ServiceException:无法创建请求的服务[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]