学无先后,达者为师

网站首页 编程语言 正文

Failed to load ApplicationContext

作者:huayang183 更新时间: 2022-03-14 编程语言

解决: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

在这里插入图片描述

 

application.yml

原文链接:https://blog.csdn.net/qq_18671415/article/details/120798441

栏目分类
最近更新