We Are Going To Discuss About “Could not autowire. No beans of type… found” with Simple project. So lets Start this Java Article.
“Could not autowire. No beans of type… found” with Simple project
- “Could not autowire. No beans of type… found” with Simple project
You need to add the
@EnableJpaRepositories(basePackages = {"your.pkg.here"})
to theTestApplication
. This tells Spring Data to look for your repository classes under the specified package. If the repository package name is the same as theTestApplication
, you can skip thebasePackages
part. - “Could not autowire. No beans of type… found” with Simple project
You need to add the
@EnableJpaRepositories(basePackages = {"your.pkg.here"})
to theTestApplication
. This tells Spring Data to look for your repository classes under the specified package. If the repository package name is the same as theTestApplication
, you can skip thebasePackages
part.
Solution 1
A couple of possibilities here.
You need to add the @EnableJpaRepositories(basePackages = {"your.pkg.here"})
to the TestApplication
. This tells Spring Data to look for your repository classes under the specified package. If the repository package name is the same as the TestApplication
, you can skip the basePackages
part.
Similarly, if your TestApplication
and SimpRepository
are not in the same package, you need to add a @ComponentScan
with the list of all relevant packages.
Original Author metacubed Of This Content
Solution 2
I missed a simple @Component
for the class. This could be one basic problem.
Original Author inquisitive Of This Content
Solution 3
Add a simple @Repository
annotation above your repository class and it will work fine.
Original Author david-so Of This Content
Solution 4
I have a similar issue IDEA-271551 just opened with JetBrains. Please upvote it.
In my case I resolved(not actual resolution,but workaround) it by explicitly annotating my repository interface with @Repository stereotype.
However, I also noticed that later if I again remove the annotation the IDE no longer complains.
Strange, but it did happen in my case.
Original Author Asif Kamran Malick Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.