【发布时间】:2016-12-14 16:52:53
【问题描述】:
我正在使用 Spring Boot 和 Katharsis 构建一个 API。使用 RestAssured 编写集成测试时,我的测试在 STS 中通过,但在 Maven 中得到 404。我不确定可能有什么不同或为什么它不起作用。
运行 API 一切正常。
我想知道是否有人有任何想法?
【问题讨论】:
标签: maven spring-boot rest-assured katharsis
我正在使用 Spring Boot 和 Katharsis 构建一个 API。使用 RestAssured 编写集成测试时,我的测试在 STS 中通过,但在 Maven 中得到 404。我不确定可能有什么不同或为什么它不起作用。
运行 API 一切正常。
我想知道是否有人有任何想法?
【问题讨论】:
标签: maven spring-boot rest-assured katharsis
所以问题与Reflections 没有在测试启动时填充我的ResourcesRepository 这一事实有关。我在这里发现了类似的问题:
Unit test using the Reflections google library fails only when executed by Maven
并使用以下链接配置 Maven Surefire 插件:
http://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html
添加以下配置有帮助:
<useSystemClassLoader>false</useSystemClassLoader>
【讨论】: