[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 {
posted @ 2021-06-20 15:18  小小文艺范  阅读(144)  评论(0编辑  收藏  举报

contact me

email:78910421@qq.com