解决:Failed to load ApplicationContext
一般按照如下步骤即可解决
第一步:检查注解
检查是否有如下注解
@RunWith(SpringRunner.class) @SpringBootTest
如果没有,添加依赖并补充注解
<dependency> <groupId>junit
groupId> <artifactId>junit
artifactId> <version>4.13
version> <scope>test
scope>
dependency>
第二步:检查包名
检查xml文件中的包名或者包的路径是否正确,因为是通过xml来配置bean,对于无法加载,一般情况下都是从将其注入到容器中的xml文件入手。
示例:

第三步:检查编码格式
setting

application.yml

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/221045.html原文链接:https://javaforall.net
