Spring Boot-嵌套异常是org.springframework.beans.factory.nosuchbeandefinitionException:没有合格的类型bean''可用的
我正在尝试将以下语句添加到Spring Boot服务:
@Autowired
private ApELDatabasePublisherService eventPublisher;
EventPublisher的依赖性在此JAR文件中包含:
.m2\repository\com\xxxx\bip\bip-event-logging\1.5.3.7-RELEASE.jar
它编译,构建和更新本地Maven存储库,但是当我启动应用程序时,它将终止于错误消息。
最初,错误消息是这样的:
No qualifying bean of type 'com.xxxx.bip.components.el.services.ApELDatabasePublisherService' available
但是,当我添加com.xxxx.bip.components.el.services
中时,它消失了。
下一个消息是:
No qualifying bean of type 'com.xxxx.bip.components.el.dao.services.IApElTypeNameLookupService' available:
所以我添加了com.xxxx.bip.components.el.dao.services
到组件扫描,并且该错误消失了。
但是现在我有第三条消息不会消失,如下所示:
No qualifying bean of type 'com.xxxx.bip.components.el.repository.IApELEventTypeRepository' available
即使我将以下内容添加到组件扫描时,此消息仍保留:
com.xxxx.bip.components.el.repository
因此,我的当前扫描看起来像这样:
@EnableRetry
@EnableScheduling
@SpringBootApplication(exclude = { HibernateJpaAutoConfiguration.class })
@ComponentScan(basePackages = {
"com.xxxx.bip.components.el.services",
"com.xxxx.bip.components.el.dao.services",
"com.xxxx.bip.components.el.repository",
我已经验证了所讨论的类,> iApeleventtyperepository
包含在JAR文件中,并注释为“ @repository”,
为什么当它找到前两个软件包时它找不到它?
I'm trying to add the following statement to a Spring Boot service:
@Autowired
private ApELDatabasePublisherService eventPublisher;
The dependency for eventPublisher is contained in maven, in this jar file:
.m2\repository\com\xxxx\bip\bip-event-logging\1.5.3.7-RELEASE.jar
It compiles, builds and updates the local maven repository, but when I launch the application, it terminates with an error message.
Initially, the error message was this:
No qualifying bean of type 'com.xxxx.bip.components.el.services.ApELDatabasePublisherService' available
However, that disappeared when I added com.xxxx.bip.components.el.services
to the component scan.
The next message was this:
No qualifying bean of type 'com.xxxx.bip.components.el.dao.services.IApElTypeNameLookupService' available:
So I added com.xxxx.bip.components.el.dao.services
to the component scan, and that error went away.
But now I have a third message which is not going away, as follows:
No qualifying bean of type 'com.xxxx.bip.components.el.repository.IApELEventTypeRepository' available
This message stays even when I add the following to component scan:
com.xxxx.bip.components.el.repository
So my current scan looks like this:
@EnableRetry
@EnableScheduling
@SpringBootApplication(exclude = { HibernateJpaAutoConfiguration.class })
@ComponentScan(basePackages = {
"com.xxxx.bip.components.el.services",
"com.xxxx.bip.components.el.dao.services",
"com.xxxx.bip.components.el.repository",
I've verified that the class in question, IApELEventTypeRepository
is included in the jar file and is annotated as "@Repository"
Why would it not find it when it finds the previous two packages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您正在使用另一个软件包中的存储库/entites工作,因此它找不到存储库来为其进行默认实现。
尝试添加您的配置
,很可能需要添加注释,以便春季可以找到实体。
Since you are working with the repositories/entites located in the another package than spring application, it can't find repositories in order to make a default implementations for them.
Try to add to your configuration
And most probably, you will need to add annotation, so that Spring can find entities.