'Spring Boot - nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type '' available
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?
Solution 1:[1]
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
@EnableJpaRepositories(basePackages="<repository package name>")
And most probably, you will need to add annotation, so that Spring can find entities.
@EntityScan("packages")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sve Kamenska |
