注射时没有我的类型的限定豆

时间:2016-11-07 14:44:44

标签: java mysql spring mongodb spring-mvc

我正在尝试使用两个数据库创建 REST spring应用程序 MySQL MongoDB 。我在弹簧数据中存储库存在问题。我需要一个JPA存储库和一个MongoDB存储库。我不想将它们分开,因为那时我需要将我的分开。

此项目的link

有8个测试类。 4表示nosql数据库,4表示关系数据库。现在测试关系数据库的工作原理。如果您在CrudRepositoryMongoRepository更改com.javaworkspace.repositories,则可以使用nosql数据库测试。

层次结构MongoRepositoryCrudRepository延伸,但是当我执行此代码时,我会得到这样的例外情况:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.javaworkspace.repositories.MarkRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.javaworkspace.repositories.MarkRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

0 个答案:

没有答案