在开发 SpringBoot 项目时, 运行单元测试 Junit 发生异常
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context
解决: 该 Junit 类所在包不是启动主类 XxApplication
所在包的同名包或者子包导致.
移动该 Junit 类, 确保把该 Junit 类所在包是启动主类同名包或同名子包
在开发 SpringBoot 项目时, 运行单元测试 Junit 发生异常
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context
解决: 该 Junit 类所在包不是启动主类 XxApplication
所在包的同名包或者子包导致.
移动该 Junit 类, 确保把该 Junit 类所在包是启动主类同名包或同名子包