01
22
47
52
为了账号安全,请及时绑定邮箱和手机立即绑定

初始化错误:无法找到@SpringBootConfiguration

初始化错误:无法找到@SpringBootConfiguration

守着星空守着你 2023-12-13 17:18:20
截至昨天,我的所有测试都在运行,现在我的扩展 BaseSpringBootTest 类的测试失败了。测试应用程序类@SpringBootTest//@PropertySource(value = "classpath*:override.properties", ignoreResourceNotFound = true)//@ImportResource("classpath*:applicationContext.xml")@ComponentScan("com.myorg")public class TestApplication {    public static void main(String[] args) {        SpringApplication.run(TestApplication.class, args);    }}BaseSpringBootTest.class@RunWith(SpringRunner.class)@SpringBootTest()@ActiveProfiles("test")public abstract class BaseSpringBootTest {  @Resource protected DomainOntology domainOntology;  @Before  public void before() throws InterruptedException, JAXBException, IOException {    domainOntology.initializeCacheIfNeeded();    ;  }}测试抛出错误public class CacheFormatterTest extends BaseSpringBootTest {    @Resource    CacheFormatter cf;    SpelEvaluator spel = new SpelEvaluator();    @Test    public void testFormatWithMockedRecordGenerator() throws IOException {我期望它能够达到并运行此测试,但它似乎无法初始化。它昨天还在运行,我似乎不知道是什么让它停止了。
查看完整描述

1 回答

?
catspeake

TA贡献1111条经验 获得超0个赞

找到我的 @SpringBootApplication 类时遇到问题,我继续将该类移动到根目录中,因为它正在我的测试包上方的包中查找它。



查看完整回答
反对 回复 2023-12-13

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号