Spring data jpa- No bean named 'entityManagerFactory' is defined; Injection of autowired dependencies failed
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)
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException
I add this dependency and I solved.
<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
Related Topics
Spring Data JPA and Parameters That Can Be Null
Field Required a Bean Which Could Not Be Found in Springboot
String Match of Only 3 Specific Words
Null Pointer on an Autowired Bean Which Is Not Mocked by Mockito
Java - How to Write My Arraylist to a File, and Read (Load) That File to the Original Arraylist
How to Display Auto-Configuration Report When Running a Spring Boot Application
How to Get All Keys from a Json-Object as a String Array in Java
Setonclicklistener() on a Null Object Reference Error
Spring Boot Search Data Between Two Dates
How to Check If a Json Key Exists
How to Make a Multipart/Form-Data Post Request Using Java
Find Everything Between Two Xml Tags With Regex
Enter Array Without Knowing Its Size
Better Way to Detect If a String Contains Multiple Words
How to Test Code Dependent on Environment Variables Using Junit
How to Convert Utc Time into Local Time in Java
How to Move Marker Along Polyline Using Google Map
Java:How to Determine the Correct Charset Encoding of a Stream