question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting error - Field repository in hello.Application required a bean of type 'hello.CustomerRepository' that could not be found.

See original GitHub issue

Thanks very nice tutorial.

I have cloned the project and when trying to nun Application.java as SpringBoot application gets the below error. CustomerRepositoryTests.java also gives the same error.

. ____ _ __ _ _ /\ / __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ’ / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) ) ’ |
| .__|| ||| |_, | / / / / =========||==============|/=//// :: Spring Boot :: (v1.5.7.RELEASE)

2017-10-15 21:24:07.546 INFO 819 — [ main] hello.Application : Starting Application on Jayakumars-iMac with PID 819 (/Users/jay/git/gs-accessing-data-mongodb/complete/target/classes started by jay in /Users/jay/git/gs-accessing-data-mongodb/complete) 2017-10-15 21:24:07.547 INFO 819 — [ main] hello.Application : No active profile set, falling back to default profiles: default 2017-10-15 21:24:07.571 INFO 819 — [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@23bb8443: startup date [Sun Oct 15 21:24:07 BST 2017]; root of context hierarchy 2017-10-15 21:24:07.806 WARN 819 — [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘application’: Unsatisfied dependency expressed through field ‘repository’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘hello.CustomerRepository’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2017-10-15 21:24:07.810 INFO 819 — [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled. 2017-10-15 21:24:07.867 ERROR 819 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Field repository in hello.Application required a bean of type ‘hello.CustomerRepository’ that could not be found.

Action:

Consider defining a bean of type ‘hello.CustomerRepository’ in your configuration.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
GauravWablecommented, Jul 27, 2018

Getting same error in Spring boot version (v2.0.3.RELEASE)

6reactions
Joby1985commented, Oct 2, 2018

Just add @EnableFeignClients annotation in your main springboot application class (where you annotate @SpringBootApplication). This will work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Field required a bean of type that could not be found.' error ...
(Yes, I'm new into Spring) If you are using a service class add @Service, and same for @Controller and @Repository. Then this annotations...
Read more >
Service required a bean of type that could not be found
I'm working on a spring boot project (following this tutorial). Consequently, I'm relying on the Apache Derby database to store my data.
Read more >
Consider defining a bean of type in your configuration Field ...
spring #springboot # error #springerror #springbooterror # bean # field #configuration Instagram: ...
Read more >
Field required a bean of type that could not be found - YouTrack
Hello Idea Support, I am a new user but I love the IDE.Recently I faced an issue. My Spring Boot repositories stopped scanning...
Read more >
Field in required a bean of type that could not be found
You can use an annotation such as @Component, @Service, @Repository, @Controller to load in the spring boot context. If the java class is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found