Spring Boot Controller IT测试没有找到类路径资源

时间:2018-04-27 15:42:42

标签: spring spring-boot spring-test-mvc

我有一个带有单元测试和IT测试的spring boot web应用程序。该应用程序还有一个DAL,我在DAL层有单元测试,它使用内存H2数据库进行测试。使用与我的生产环境相同的liquibase changelog创建h2数据库。

更改日志打包在jar中,并在我的DAL测试中通过将其添加到我的application.yml文件中引用:

liquibase:
  change-log: classpath:src/changeLogs/db-changelog-master.xml

这在我的DAL项目中工作正常但在我的web项目中没有。在我的Web项目中,我收到此错误:

Cannot find changelog location: class path resource [src/changeLogs/db-changelog-master.xml] 

无法找到更改日志的测试是Spring Boot IT测试。被测试的类是一个Spring Controller。测试注释如下:

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"IT","development"})

这里有什么想法吗?感谢。

0 个答案:

没有答案