[bug记录]java.lang.illegalstateexception failed to load applicationcontext

在springboot test的时候报错,提示没有载入应用上下文。
首先检查pom依赖是否导入正确

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

如果改过配置文件,在测试类上加上这个注解

@SpringBootTest
@TestPropertySource("classpath:application.yml")
class SeckillDemoApplicationTests {
原文地址:https://www.cnblogs.com/wangzhihang/p/14906856.html