У меня есть простой проект Spring Boot с JPA, Web и PostgreSQL.Я использую последнюю версию Spring Boot 2.1.3.RELEASE .
После добавления простого приложения JpaRepository происходит сбой при запуске со следующей ошибкой:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field dataMappingRepository in com.my.example.service.impl.SimpleServiceImpl required a bean named 'entityManagerFactory' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean named 'entityManagerFactory' in your configuration.
Iиметь простой класс @Service, такой как:
public class SimpleServiceImpl implements SimpleService {
@Autowired private SimpleJpaRepository repo;
}
И JpaRepository:
public interface SimpleJpaRepository extends JpaRepository<SimpleEntity, Long> {}
А вот мое application.yml:
spring:
datasource:
url: jdbc:postgresql://localhost:5432/simple
username: user
password: pass
driver-class-name: org.postgresql.Driver
jpa:
show-sql: false
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: validate
Если я изменю spring-boot-starter-parent до 2.0.8.RELEASE приложение запускается правильно.