配置问题
报错一
java.lang.IllegalStateException: Failed to load ApplicationContext
一边出现这种情况都是配置写错了 你可以仔细看看你的xml配置
我是由于mybatis的mapper文件下的xml 所映射的user类写成了User类
报错二
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxx': Unsatisfied dependency expressed through field 'xxx'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'xxx' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)
在对service类进行单元测试的发现怎么样都无法进行通过
最后对service的impl实现类前面加上了 @Service
报错三
Error creating bean with name 'xxx':
发现怎么样都找不到bean, 就怀疑springboot没有注入bean,在springboot启动类加入了这一句注解
@ComponentScan(basePackages = {“com.anthony1314.xxx.xxx”})
第一个xxx 代表你的项目名
第二个xxx 代表你想扫描的包

本文详细解析了SpringBoot中常见的配置问题,包括非法状态异常、依赖未满足异常及bean无法找到的情况,探讨了XML配置错误、类名大小写不一致及组件扫描范围不当等问题,并提供了具体的解决策略。
706

被折叠的 条评论
为什么被折叠?



