Getting error - Field repository in hello.Application required a bean of type 'hello.CustomerRepository' that could not be found.
See original GitHub issueThanks 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:
- Created 6 years ago
- Comments:32 (4 by maintainers)
Top GitHub Comments
Getting same error in Spring boot version (v2.0.3.RELEASE)
Just add @EnableFeignClients annotation in your main springboot application class (where you annotate @SpringBootApplication). This will work.