为了账号安全,请及时绑定邮箱和手机立即绑定

出现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


正在回答

4 回答

girlservice类上加个@Service注解声明一下

1 回复 有任何疑惑可以回复我~

也是遇到同样为问题

求解答

0 回复 有任何疑惑可以回复我~

解决了吗?
我也报同样的错误

0 回复 有任何疑惑可以回复我~
#1

游侠最光阴 提问者

没有解决啊
2018-03-12 回复 有任何疑惑可以回复我~

你得把你的代码发出来,光看报错怎么知道哪里错了

0 回复 有任何疑惑可以回复我~
#1

游侠最光阴 提问者

代码就是老师的代码???
2018-03-02 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
2小时学会Spring Boot
  • 参与学习       151599    人
  • 解答问题       1079    个

Spring Boot入门视频教程,你将学会使用Spring Boot快速构建应用程序

进入课程

出现Field girlRepository in com.rjx.springbootdemo.GirlController required a bean of type 'com.rjx.springbootdemo.GirlRepository' that could not be found.问题,该如何解决?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信