【问题标题】:"Ambiguous search mapping detected" thrown after adding Springfox 3.0.0 to SpringBoot将 Springfox 3.0.0 添加到 SpringBoot 后抛出“检测到不明确的搜索映射”
【发布时间】:2021-11-20 16:35:02
【问题描述】:

我有一个 SpringBoot 应用程序 (spring-boot-starter-parent:2.4.0),我想使用 Swagger。我关注了这个Baeldung-Tutorial,不幸的是我在启动时遇到了这个异常:

org.springframework.context.ApplicationContextException: 失败 启动 bean 'documentationPluginsBootstrapper';嵌套异常是 java.lang.IllegalStateException:检测到不明确的搜索映射。

这是因为在某些情况下我会在我的存储库中重载方法,如下所示:

Page<Message> findByConversationId(Long conversationId, Pageable pageable);
List<Message> findByConversationId(Long conversationId);

异常说这两种方法

映射到 /findByConversationId!将配置调整为 找到明确的路径!

有什么办法可以解决这个问题吗? 谢谢!

【问题讨论】:

    标签: spring-boot swagger springfox-boot-starter


    【解决方案1】:

    这不是您问题的答案,但它可能对您有所帮助。 考虑使用 springdoc 而不是 Springfox。它是一个较新的库,比 Springfox 更易于使用且不易出错。我们在 2 年前搬到这里,我们很高兴我们做到了。网上有很好的文档和教程:

    它也非常活跃,您通常会在github page 上很快得到解答。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-10
      • 2015-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-25
      • 2019-07-04
      相关资源
      最近更新 更多