SpringBoot启动失败Application run failed的解决办法

发布于:2022-12-09 ⋅ 阅读:(1555) ⋅ 点赞:(1)


项目场景:

提示:这里简述项目相关背景000:
这个问题遇到好多次了,一直没能记录下来,今天又碰到了
在这里插入图片描述

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
ERROR 1572 — [ restartedMain] o.s.boot.SpringApplication : Application run failed


问题描述

SpringBoot 服务启动的时候报错:

下面是错误报告我用回车隔开方便检查

 Error creating bean with name 'userAction': 
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 'mapper'; 
nested exception is org.springframework.beans.factory.

UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file[E:\桌面\springbootdemo\target\classes\cn\edu\neu\springbootdemo\mapper\UserMapper.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 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.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 org.springframework.core.

NestedIOException: Failed to parse mapping resource: 'file [E:\桌面\springbootdemo\target\classes\mapper\UserMapper.xml]'; 

nested exception is org.apache.ibatis.builder.
BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 36;
在 XML 声明中的编码伪属性前面必须有空格。

原因分析:Caused by

这个问题得具体问题具体分析,得看下面那些报错什么意思,不能直接去网上找解决办法
刚才也是找了好多博主写的文章都没解决
比如说我的报错信息是:
创建名为 “userAction” 的 bean 时出错
创建名为“userServiceImpl”的bean时出错
定义的名为“sqlSessionFactory”的bean时出错
在 XML格式声明中的编码伪属性前面必须有空格


解决方案:

检查代码

在这里插入图片描述

注:

重要的不是问题解决了,重要的是解决问题的过程
还有error才会影响程序的运行,warning警告不用管
根据错误的提示去想,为什么找不到这个bean/class?通过这个错误一步步去跟踪,找到根本的原因,这是积累知识的过程
等以后这种问题发现地慢慢的多起来,慢慢地积累起来,积累的经验越多越好
英语很重要,不仅仅是处理问题的时候、出错的时候、分析问题的时候都是英文

本文含有隐藏内容,请 开通VIP 后查看

微信公众号

今日签到

点亮在社区的每一天
去签到