gpt4 book ai didi

java - ..RoleService 中构造函数的参数 0 需要一个名为 'entityManagerFactory' 的 bean,但无法找到

转载 作者:行者123 更新时间:2023-12-01 16:16:40 27 4
gpt4 key购买 nike

我正在尝试创建一个基本的 Spring Boot 应用程序,当我尝试实现存储库时,我不断收到此错误:

    Description:

Parameter 0 of constructor in com.frana.taskme.services.RoleService required a bean named 'entityManagerFactory' that could not be found.

Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.

我在 Application.java 中使用了各种注释和各种属性,但没有任何变化。

这是我的存储库,您可以在其中找到该应用程序:https://github.com/franagibo/test

pom的依赖有问题吗?

最佳答案

更新您的 pom.xml jpa 依赖项:

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

application.propertiesspring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 中删除

不要忘记更新依赖项,您可能需要清理 m2/repository。

关于java - ..RoleService 中构造函数的参数 0 需要一个名为 'entityManagerFactory' 的 bean,但无法找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62376038/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com