【问题标题】:RestAssured Spring Boot Test returning 404sRestAssured Spring Boot Test 返回 404s
【发布时间】:2016-12-14 16:52:53
【问题描述】:

我正在使用 Spring Boot 和 Katharsis 构建一个 API。使用 RestAssured 编写集成测试时,我的测试在 STS 中通过,但在 Maven 中得到 404。我不确定可能有什么不同或为什么它不起作用。

运行 API 一切正常。

我想知道是否有人有任何想法?

代码仓库在这里:https://github.com/Holmes89/liturgical-project

【问题讨论】:

    标签: maven spring-boot rest-assured katharsis


    【解决方案1】:

    所以问题与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>
    

    【讨论】:

      猜你喜欢
      • 2020-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-28
      • 2017-04-01
      相关资源
      最近更新 更多