Java Spring Boot: Consider defining a bean named 'entityManagerFactory' in your configuration
Well, after 17 days finally I got the solution:
my problem was on properties file, for some reason I used this line (I can't remember why):
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
I just commented it and problem solved.
Lessons learned:
- always document your code
- JitterTed's discord is a great source of answers.
Spring Boot: Consider defining a bean named 'entityManagerFactory' in your configuration
In spring-boot, you don't need to annotate your repository class with the repository annotation.
@Repository
You just need to extend JPARepository on your interface and Spring-boot will take care of the rest.
For Example:
public interface YourRepository extends JpaRepository<YourDomain, Serializable> {
YourDomain findBysomeparameter(Long parameter);
}
And you don't need to add these annotations:
@EnableJpaRepositories
@EntityScan
@ComponentScan
Spring-boot does that automatically unless you're doing some configuration.
I hope this will help.
Related Topics
How to Return a Zip File to the Browser Via the Response Outputstream
Return Json Object from a Spring-Boot Rest Controller
Java How to Set an Auto Increment Attribute
Resource from Src/Main/Resources Not Found After Building With Maven
How to Test a Void Method Using Junit And/Or Mockito
How to Replace Non-Printable Unicode Characters in Java
Netbeans Tomcat Build Failed - the Module Has Not Been Deployed
How to Enable Request Scope in Async Task Executor
How to Load 100 Million Rows in to Memory
Error: Incompatible Types: List<Integer> Cannot Be Converted to Arraylist<Integer>
How to Import Two Classes With the Same Name in Different Packages
Spring Rest Handling Empty Request Body (400 Bad Request)
Checking for Null on a Collection in Jpql Queries
The Group Coordinator Is Not Available-Kafka
Warning the Requested Profile "Pom.Xml" Could Not Be Activated Because It Does Not Exist
How to Read File from Relative Path in Java Project? Java.Io.File Cannot Find the Path Specified
Field Required a Bean Which Could Not Be Found in Springboot