账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Spring Boot启动报错
    66
    0

    报错类型:

    Field xxxDao in xxxServiceImpl required a bean of type xxx that could not be found.

    详细情况如下:

    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.0.2.RELEASE)
    
    2019-07-19 10:45:06.433  INFO 3644 --- [           main] com.meituan.hotel.Application            : Starting Application on LAPTOP-2N82SD03 with PID 3644 (E:\CodeCache\IDEA\Webmagic\meituan-crawler-hotel\target\classes started by 三寸旧城七寸执念 in E:\CodeCache\IDEA\Webmagic\meituan-crawler-hotel)
    2019-07-19 10:45:06.435  INFO 3644 --- [           main] com.meituan.hotel.Application            : No active profile set, falling back to default profiles: default
    2019-07-19 10:45:06.472  INFO 3644 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@197d671: startup date [Fri Jul 19 10:45:06 CST 2019]; root of context hierarchy
    2019-07-19 10:45:07.211  INFO 3644 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
    2019-07-19 10:45:07.229  INFO 3644 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2019-07-19 10:45:07.229  INFO 3644 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.31
    2019-07-19 10:45:07.232  INFO 3644 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
    2019-07-19 10:45:07.232  INFO 3644 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
    2019-07-19 10:45:07.232  INFO 3644 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
    2019-07-19 10:45:07.235  INFO 3644 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]
    2019-07-19 10:45:07.351  INFO 3644 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2019-07-19 10:45:07.351  INFO 3644 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 882 ms
    2019-07-19 10:45:07.459  INFO 3644 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
    2019-07-19 10:45:07.462  INFO 3644 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
    2019-07-19 10:45:07.462  INFO 3644 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
    2019-07-19 10:45:07.462  INFO 3644 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
    2019-07-19 10:45:07.462  INFO 3644 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
    2019-07-19 10:45:07.490  WARN 3644 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hotelInfoServiceImpl': Unsatisfied dependency expressed through field 'hotelInfoDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.meituan.hotel.Dao.HotelInfoDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    2019-07-19 10:45:07.492  INFO 3644 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    2019-07-19 10:45:07.504  INFO 3644 --- [           main] ConditionEvaluationReportLoggingListener : 
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2019-07-19 10:45:07.573 ERROR 3644 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    
    ***************************
    APPLICATION FAILED TO START
    ***************************
    
    Description:
    
    Field hotelInfoDao in com.meituan.hotel.Service.impl.HotelInfoServiceImpl required a bean of type 'com.meituan.hotel.Dao.HotelInfoDao' that could not be found.
    
    
    Action:
    
    Consider defining a bean of type 'com.meituan.hotel.Dao.HotelInfoDao' in your configuration.
    
    
    Process finished with exit code 1
    

    最近网项目里面加了个模块,模块是基于gradle的工程,我本身的工程是基于maven的,没有导成功,我就把那个模块删除掉了,但是运行就出问题了,网上搜了很多,但是我的注解都加了,而且目录结构也没有问题,Application.class也的确在包的最外层。

    希望有大佬帮忙解答一下

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • 熱情餵給風 普通会员 1楼

      Spring Boot启动报错的原因有很多,以下是一些常见的原因和解决方案:

      1. 缺少依赖:如果你在项目中缺少某些依赖,那么你的应用将无法启动。你可以尝试添加缺失的依赖,或者通过Maven或Gradle管理依赖。

      2. 配置问题:如果你的配置文件有问题,那么你的应用将无法启动。你需要检查并修改你的配置文件,确保所有的配置选项都正确设置。

      3. 错误信息:如果你的应用启动报错,但没有提供具体的错误信息,那么你可能无法找到问题的原因。你需要查看你的错误日志,看看是否有错误的堆栈跟踪。

      4. Spring Boot版本问题:如果你的Spring Boot版本过低,那么你的应用可能无法启动。你可以尝试升级你的Spring Boot版本。

      5. 代码问题:如果你的代码有问题,那么你的应用将无法启动。你需要检查你的代码,确保没有语法错误,也没有逻辑错误。

      如果你无法确定问题的原因,你可以尝试提供更多的错误信息和详细信息,这样我才能帮助你找到问题的原因。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部