出現Field girlRepository in com.rjx.springbootdemo.GirlController required a bean of type 'com.rjx.springbootdemo.GirlRepository' that could not be found.問題,該如何解決?
? . ? ____ ? ? ? ? ?_ ? ? ? ? ? ?__ _ _
?/\\ / ___'_ __ _ _(_)_ __ ?__ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
?\\/ ?___)| |_)| | | | | || (_| | ?) ) ) )
? ' ?|____| .__|_| |_|_| |_\__, | / / / /
?=========|_|==============|___/=/_/_/_/
?:: Spring Boot :: ? ? ? ?(v1.4.7.RELEASE)
2018-03-02 01:47:27.951 ?INFO 5996 --- [ ? ? ? ? ? main] c.r.s.SpringbootdemoApplication ? ? ? ? ?: Starting SpringbootdemoApplication on Prayjourney with PID 5996 (D:\MyAllCodes\MySpringL\springbootdemo\target\classes started by prayjourney in D:\MyAllCodes\MySpringL\springbootdemo)
2018-03-02 01:47:27.958 ?INFO 5996 --- [ ? ? ? ? ? main] c.r.s.SpringbootdemoApplication ? ? ? ? ?: The following profiles are active: dev
2018-03-02 01:47:28.115 ?INFO 5996 --- [ ? ? ? ? ? main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4d9e68d0: startup date [Fri Mar 02 01:47:28 CST 2018]; root of context hierarchy
2018-03-02 01:47:32.900 ?INFO 5996 --- [ ? ? ? ? ? main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8083 (http)
2018-03-02 01:47:32.924 ?INFO 5996 --- [ ? ? ? ? ? main] o.apache.catalina.core.StandardService ? : Starting service [Tomcat]
2018-03-02 01:47:32.926 ?INFO 5996 --- [ ? ? ? ? ? main] org.apache.catalina.core.StandardEngine ?: Starting Servlet Engine: Apache Tomcat/8.5.15
2018-03-02 01:47:33.162 ?INFO 5996 --- [ost-startStop-1] o.a.c.c.C.[.[.[/springbootdemo] ? ? ? ? ?: Initializing Spring embedded WebApplicationContext
2018-03-02 01:47:33.163 ?INFO 5996 --- [ost-startStop-1] o.s.web.context.ContextLoader ? ? ? ? ? ?: Root WebApplicationContext: initialization completed in 5054 ms
2018-03-02 01:47:33.525 ?INFO 5996 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean ?: Mapping servlet: 'dispatcherServlet' to [/]
2018-03-02 01:47:33.540 ?INFO 5996 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean ? : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-02 01:47:33.541 ?INFO 5996 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean ? : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-02 01:47:33.543 ?INFO 5996 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean ? : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-02 01:47:33.544 ?INFO 5996 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean ? : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-02 01:47:33.684 ?WARN 5996 --- [ ? ? ? ? ? main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'girlController': Unsatisfied dependency expressed through field 'girlRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.rjx.springbootdemo.GirlRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2018-03-02 01:47:33.691 ?INFO 5996 --- [ ? ? ? ? ? main] o.apache.catalina.core.StandardService ? : Stopping service [Tomcat]
2018-03-02 01:47:33.773 ?INFO 5996 --- [ ? ? ? ? ? main] utoConfigurationReportLoggingInitializer :?
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-03-02 01:47:34.250 ERROR 5996 --- [ ? ? ? ? ? main] o.s.b.d.LoggingFailureAnalysisReporter ? :?
***************************
APPLICATION FAILED TO START
***************************
Description:
Field girlRepository in com.rjx.springbootdemo.GirlController required a bean of type 'com.rjx.springbootdemo.GirlRepository' that could not be found.
Action:
Consider defining a bean of type 'com.rjx.springbootdemo.GirlRepository' in your configuration.
Process finished with exit code 1
2018-08-15
girlservice類上加個@Service注解聲明一下
2018-03-15
也是遇到同樣為問題
求解答
2018-03-11
解決了嗎?
我也報同樣的錯誤
2018-03-02
你得把你的代碼發出來,光看報錯怎么知道哪里錯了