【问题标题】:Parameter 0 of constructor required a bean of type 'javax.persistence.EntityManager' that could not be found构造函数的参数 0 需要找不到类型为 \'javax.persistence.EntityManager\' 的 bean
【发布时间】:2023-02-05 19:03:05
【问题描述】:

嗨,我正在研究 spring boot,我尝试了很多方法,我一直收到这个错误,但它没有发生,一些代码显示红色,你能帮忙吗enter image description here enter image description here enter image description here

【问题讨论】:

    标签: spring spring-boot hibernate


    【解决方案1】:

    您需要使用用户名、密码和主机配置实体管理器。 hibernate 需要entitymanager 来连接数据库。您可以像这样添加配置

    spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
    spring.datasource.password=root
    spring.datasource.username=root
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-20
      • 2018-12-06
      • 1970-01-01
      • 2022-08-11
      • 2023-02-07
      • 2019-03-21
      • 2020-02-23
      • 2021-02-02
      相关资源
      最近更新 更多