Failed to load ApplicationContext

来源:3-1 开发环境搭建

闫之有理

2019-08-14

运行单元测试的时候报错如下:
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

加入 @SpringBootTest(classes = Application.class)之后报错如下:
java.lang.IllegalStateException: Failed to load ApplicationContext

写回答

1回答

廖师兄

2019-08-15

@SpringBootTest里面是不用加内容的。你可以检查jdk、springboot版本。还可以用我给的源码运行。对比。那我还解决不了。你把项目代码push到git(github, 慕课网git都行),发我链接,我这边运行看看。

0
4
廖师兄
回复
闫之有理
什么原因呢
2019-08-16
共4条回复

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6416 学习 · 5257 问题

查看课程