2015年12月28日 星期一

Spring data jpa- No bean named 'entityManagerFactory' is defined;

Spring data jpa- No bean named 'entityManagerFactory' is defined


Spring Data JPA by default looks for an EntityManagerFactory named entityManagerFactory. Check out this part of the Javadoc of EnableJpaRepositories or Table 2.1 of the Spring Data JPA documentation.
That means that you either have to rename your emf bean to entityManagerFactory or change your Spring configuration to:
<jpa:repositories base-package="your.package" entity-manager-factory-ref="emf" /> 
(if you are using XML)
or
@EnableJpaRepositories(basePackages="your.package", entityManagerFactoryRef="emf")
(if you are using Java Config)

沒有留言:

張貼留言