I have simple Spring Boot project with JPA, Web and PostgreSQL. I'm using the latest Spring Boot version 2.1.3.RELEASE.
After adding simple JpaRepository application fails on startup with the following error:
***************************
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 have a simple @Service class like:
public class SimpleServiceImpl implements SimpleService {
@Autowired private SimpleJpaRepository repo;
}
And JpaRepository:
public interface SimpleJpaRepository extends JpaRepository<SimpleEntity, Long> {}
And here is my 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
If I change spring-boot-starter-parent to 2.0.8.RELEASE the application starts correctly.