SpringBoot启动报错:org.springframework.beans.factory.UnsatisfiedDependencyException Error creating
完整报错如下:太长,把我认为重要信息用下划线标重点。
WARN 7612 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘processBusinessController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [F:code ariacs5g ariacs5g_src ariacs5g-parent ariacs5g-power-parent2 ariacs5g-host-service2 argetclassescom ariacshostmapperUserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory
2020-12-25 21:55:07.728 INFO 7612 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-12-25 21:55:07.737 INFO 7612 — [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2020-12-25 21:55:07.757 ERROR 7612 — [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘processBusinessController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [F:code ariacs5g ariacs5g_src ariacs5g-parent ariacs5g-power-parent2 ariacs5g-host-service2 argetclassescom ariacshostmapperUserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessorKaTeX parse error: Undefined control sequence: \[ at position 78: …sor.java:598) ~\̲[̲spring-beans-5.…doGetBeanKaTeX parse error: Undefined control sequence: \[ at position 34: …ory.java:321) ~\̲[̲spring-beans-5.…doGetBeanKaTeX parse error: Undefined control sequence: \[ at position 34: …ory.java:321) ~\̲[̲spring-beans-5.…AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:595) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
… 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [F:code ariacs5g ariacs5g_src ariacs5g-parent ariacs5g-power-parent2 ariacs5g-host-service2 argetclassescom ariacshostmapperUserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1506) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1386) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBeanKaTeX parse error: Undefined control sequence: \[ at position 34: …ory.java:321) ~\̲[̲spring-beans-5.…ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:637) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadataKaTeX parse error: Undefined control sequence: \[ at position 53: …ata.java:180) ~\̲[̲spring-beans-5.…doGetBeanKaTeX parse error: Undefined control sequence: \[ at position 34: …ory.java:321) ~\̲[̲spring-beans-5.…EnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIB602d46a8.CGLIB602d46a8.CGLIB602d46a8.CGLIBsqlSessionFactoryKaTeX parse error: Undefined control sequence: \[ at position 17: …(<generated>) ~\̲[̲mybatis-plus-bo…EnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIB602d46a8602d46a8602d46a8FastClassBySpringCGLIBFastClassBySpringCGLIBFastClassBySpringCGLIBKaTeX parse error: Undefined control sequence: \[ at position 31: …(<generated>) ~\̲[̲mybatis-plus-bo…BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfigurationEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIB602d46a8.sqlSessionFactory() ~[mybatis-plus-boot-starter-3.4.1.jar:3.4.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.18.RELEASE.jar:5.1.18.RELEASE]
… 58 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_152]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_152]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[na:1.8.0_152]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_152]
… 70 common frames omitted
我们大概知道是创建Controller,Service,Mapper实例失败,这是第一点。看到SqlSessionFactory,想都不用想,肯定是底层Mybatis与数据库交互出现问题,这是其二。
废话不多说,解决方法:Mybatis和Mybatis-plus同时引入依赖中会引起冲突,二选其一。我们除了注意本模块的pom文件中是否冲突,还要看看本模块的父模块是否已经引入了mybaits依赖,而后来你又在本模块引入了Mybatis-plus模块,导致冲突。这种情形比较隐蔽不易发现。
SpringBoot启动报错:org.springframework.beans.factory.UnsatisfiedDependencyException Error creating相关推荐
- rg.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
1.遇到的问题 控制台出现如下错误,具体报错见附件 org.springframework.beans.factory.UnsatisfiedDependencyException: Error cr ...
- SpringBoot启动报错:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean
SpringBoot启动报错:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean ...
- springboot启动报org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean..
这是一个非常常见一个没有注入bean的错误 报错情况如下 org.springframework.beans.factory.UnsatisfiedDependencyException: Error ...
- springboot整合redis报错org.springframework.beans.factory.UnsatisfiedDependencyException
我的问题出在Cache的实现类中getId()没设置返回值. Error starting ApplicationContext. To display the conditions report r ...
- 运行Java项目报错 org.springframework.beans.factory.UnsatisfiedDependencyException
运行java时报错 org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans ...
- org.springframework.beans.factory.UnsatisfiedDependencyException Error creating bean with name
SpringBoot+SpringCloud+Maven+Mybatis Plus+Feign整合报错 自己做的小Demo报错,卡了好几天,网上能找到的方法都试过了,还是不行,最后幸得高人指点,立马解 ...
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘pro
当我在使用mybatisPlus逆向创建项目的时候加入pagehelper之后碰到的问题: . ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ...
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘emp
当在学习Spring的JdbcTemplate时,在进行测试的出现以下异常 org.springframework.beans.factory.UnsatisfiedDependencyExcepti ...
- 解决org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 问题
背景 今天在合并代码,进行打包的时候,突然发现代码跑步起来了. 把错误日志拉出来一看,好家伙,错误日志打印一大堆的 "timestamp":"2022-05-23 22: ...
最新文章
- SAP Fiori应用的三种部署方式
- 如何使用十进制range()步长值?
- linux磁盘分配方案,张明贵-Linux磁盘分区方案
- linux下C++动态链接C++库示例详解
- Hybrid App开发者一定不要错过的框架和工具
- VTK:网格之Decimation
- HashMap jdk1.7和1.8概述
- Mybatis源码阅读(一):Mybatis初始化1.3 —— 解析sql片段和sql节点
- java.exe和javaw.exe有什么区别吗?
- 茶有真香 | 一款茶好不好喝自己说了才算
- 生存分析 R语言(六)—— Extended and Stratified Cox
- chrome最新版总是自动清掉保存的密码
- R语言之循环(解决老虎机钻石匹配所有符号问题)
- 【Unity学习笔记】[Unity中文课堂教程] C#中级编程代码
- TERA: Screen-to-Camera Image Code with Transparency, Efficiency, Robustness and Adaptability论文阅读
- PCB检查-allegro PDN进行简单电源直流压降分析
- [jzoj 3461]【NOIP2013模拟联考5】小麦亩产一千八 {Fibonacci数列}
- [区间DP]JZOJ 3095 秘密文件
- hp socket android,HP-Socket精简示例
- spss打开oracle,零基础到数据挖掘精通(SPSS MODELER、EXCEL、ORACLE)