Error starting ApplicationContext. To display the conditions report re-run your application with ‘de

这篇具有很好参考价值的文章主要介绍了Error starting ApplicationContext. To display the conditions report re-run your application with ‘de。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

 遇到这个问题之前,我先遇到的问题就是如图所示的bug

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

简而言之就是说找不到dao层的bean,建议我将dao配置到spring中,但是我已经为dao加了注解,如图

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

mapper注解理应自动将这个类配置到了spring中,后续帮助我自动注入,但是他没起到作用

只能尝试用@MapperScan,扫描dao层,如图

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

 所以我在主类上加了个MapperScan

结果上面的报错消失了,取而代之的就是今天的主题报错


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
16:37:58  ERROR  Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tbUserDao' defined in file [D:\emos-wx-api\target\classes\com\example\emos\wx\db\dao\TbUserDao.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at com.example.emos.wx.EmosWxApiApplication.main(EmosWxApiApplication.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tbUserDao' defined in file [D:\emos-wx-api\target\classes\com\example\emos\wx\db\dao\TbUserDao.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:342)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
    ... 25 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tbUserDao' defined in file [D:\emos-wx-api\target\classes\com\example\emos\wx\db\dao\TbUserDao.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
    ... 36 common frames omitted
Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    at org.springframework.util.Assert.notNull(Assert.java:201)
    at org.mybatis.spring.support.SqlSessionDaoSupport.checkDaoConfig(SqlSessionDaoSupport.java:125)
    at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:73)
    at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
    ... 46 common frames omitted

Process finished with exit code 1

没有办法,只能继续研究,

 截取一段,我们重点研究:

Error creating bean with name 'tbUserDao' defined in file: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

 他还是说创建bean出错,调用初始化方法失败,不一样的是IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

对于这个报错的解决方法就要去检查你自己的依赖了,我创建springboot项目的时候用的默认最新板3.0的,后期我改成了2.3.4,但是mybatis的依赖没有跟着改,我将mybatis的版本降低,清空缓存重启后,问题解决,如图

Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

 Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

 Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

 Error starting ApplicationContext. To display the conditions report re-run your application with ‘de,spring,java,spring boot,mybatis,maven

 

希望能对你们有所帮助 文章来源地址https://www.toymoban.com/news/detail-724320.html

到了这里,关于Error starting ApplicationContext. To display the conditions report re-run your application with ‘de的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • VSCode使用Remote-SSH连接服务器时报错:Resolver error: Error: The VS Code Server failed to start

    电脑关机打开后,使用VSCode连接服务器,在输入完密码之后右下角一直没有加载完毕,一直报: 无法安装VS Code服务器 Windows终端可以ssh到服务器上;VSCode连接时报错,之前连接过。 前期准备 :在做后边的操作之前一定要记得 关闭远程 ,报错的时候会弹出弹窗或者按 ESC ,选

    2024年02月05日
    浏览(42)
  • An unexpected error has occurred. Conda has prepared the above report

    今日在服务器上创建anaconda虚拟环境的时候,出现了如下报错  直接上解决方案 在终端中输入如下指令  如果出现以下提示,说明多了一个文件  输入以下指令删掉这个文件  随后可以正常完成虚拟环境的创建

    2024年02月13日
    浏览(50)
  • An error occurred while starting the application

    An error occurred while starting the application. .NET Core 4.6.27617.05 X64 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 | Microsoft Windows 6.3.9600 | Need help? 本地与测试库正常,发布到正式环境IIS报这个错误,首先这个错误,不是版本问题,就是具体错误信息没给显示到页面上被屏蔽了,需要

    2024年02月15日
    浏览(43)
  • Unable to start the daemon process.解决方案

     错误信息如下: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.5/userguide/gradle_daemon.html Process command line: D:Javajdk-1.8binjava.exe -Xmx2048m -Dfil

    2024年02月14日
    浏览(73)
  • Conmi的正确答案——Unable to attach or mount volumes: unmounted volum...timed out waiting for the condition

    k8s:v1.22.12 kubesphere版本:v3.3 完整错误信息: 最终发现是nfs服务未打开端口: 解决方案:在nfs服务器开启端口(之前出现一次重装kubesphere不能解决直接重装系统…特此留下解决方案) 20230724145740补充:好像当时有些服务因为ks关闭防火墙导致外部无法访问,所以手动开启了

    2024年02月05日
    浏览(80)
  • Python&aconda系列:conda踩坑记录1.An unexpected error has occurred. Conda has prepared the above report

    想更新deeptools,但是发现无论如何都下载不了,并且有以下报错 按照 二. conda install安装不了任何包,报一大段错误 方法,还是不行,并且出现了新的报错 继续找解决办法 Pythonaconda系列:conda创建虚拟环境、切换环境 报错中的`三. conda create, conda install, conda update报错 光删除

    2024年04月15日
    浏览(45)
  • Error encountered when following the spring boot getting started document.

    https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html#getting-started Follow the instructions on the document, create exactly the file src/main/java/MyApplication.java with a default package (without a package ), paste exactly the code. Then I found that there’s a complain from my IDE, said “Spring Boot Application in defaul

    2024年02月02日
    浏览(41)
  • The Tomcat connector configured to listen on port 10000 failed to start. The port may already be in

    今天在学谷粒商城,启动一个电商项目,发现一个端口被占用了,记录下来

    2024年02月12日
    浏览(57)
  • 报错:The Tomcat connector configured to listen on port xxxx failed to start. The port may already be

    APPLICATION FAILED TO START Description: The Tomcat connector configured to listen on port xxxx failed to start. The port may already be in use or the connector may be misconfigured. Action: Verify the connector’s configuration, identify and stop any process that’s listening on port xxxx, or configure this application to listen on another port. 原因:

    2024年02月12日
    浏览(49)
  • Failed to start The nginx HTTP and reverse proxy server

    对于报错的描述是Address already in use,说明端口被占用: 查看被占用端口: kill占用端口:kill -9 49147 重新启动nginx,成功

    2024年02月13日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包