[英]How do I resolve a Spring UnsatisfiedDependencyException error?
[英]How do I resolve this Java Spring: entityManagerFactory Error?
我正在嘗試運行我的 java spring 應用程序,但在構建時遇到以下錯誤:
Description:
Field productRepository in ch.turwaith.mhd_tracker_backend.ProductController 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)
數據庫連接已在 application.properties 文件中正確配置。 我不知道更多,我該如何解決這個問題? 請告訴我您需要查看哪些文件才能了解問題所在。
請嘗試使用 spring initializr 重新創建您的項目:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.