Failed to load ApplicationContext

Posted 贝加尔湖畔╭

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to load ApplicationContext相关的知识,希望对你有一定的参考价值。

Failed to load ApplicationContext

今天遇到一个意料之外的错误,搜索半天发现都是很老的信息一无所获,最后自己仔细读取报错信息才发现的错误

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name \'userServiceImpl\': Unsatisfied dependency expressed through field \'baseMapper\'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type \'com.bing.blog.mapper.UserMapper\' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

因为之前使用mybatis-plus的代码自动生成器,在项目结构中有生成了 pojo包和mapper包,并且注解都配置好了,我猜想可能是因为spring容器中默认是单例模式,导致识别错误或者什么其他的错误

果然在删除多余的包后问题解决~

总结:

​ springBoot也是约定大于配置,

@MapperScan("com.bing.mapper"),不能有多余的包

1、包的目录结构要固定

2、不能有多余的包

3、不能有重复的注入

以上是关于Failed to load ApplicationContext的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序,报错,failed to load local image resource /pages/

GlideException: Failed to load resource……java.net.SocketTimeoutException(failed to connect to xxx)

GlideException: Failed to load resource……java.net.SocketTimeoutException(failed to connect to xxx)

怎么解决Chrome浏览器“Failed to load resource:net:ERR

Failed to load resource: net::ERR_CONNECTION_REFUSED

UserWarning: Failed to load image Python extension: warn(f“Failed to load image Python extension: