创建bean时出错:注入自动连接的依赖项失败

时间:2017-12-02 09:05:39

标签: java spring-boot spring-data-jpa

我是春季启动的新手,我使用Maven和JPA注释使用这些技术构建应用程序,在执行我的项目时出现此错误。这是 the error

Application Class

the repository interface the implementing class

1 个答案:

答案 0 :(得分:0)

您可以使用以下几点:

  • Spring boot auto配置自动扫描Spring bean 所以你可以删除@ComponentScan注释(假设你是新的,所以你使用相对最新的版本)。
  • 你不需要SalleRepoImpl(现在列表,因为你的用例是基本的&#34;保存&#34;)通过扩展JpaRepository<Salle, Long>你有你需要的东西(例如:findOne,findBy。 。, 找到所有) 请参阅the officiel documentation
  • 使用@Qualifier注释在您的情况下是无用的,可能是您错误的原因。
  

限定符注释有助于消除bean引用的歧义   否则Spring将无法这样做。

有关详细信息,请转至official documentation

希望它有用:)

相关问题