首页 > 解决方案 > 带有 Swagger 3 的弹簧上下文索引器

问题描述

我有一个 Maven 多模块 java 11 项目。项目配置了 Swagger 3

<dependency>
   <groupId>io.springfox</groupId>
   <artifactId>springfox-boot-starter</artifactId>
   <version>3.0.0</version>
</dependency>
<dependency>
   <groupId>io.springfox</groupId>
   <artifactId>springfox-swagger-ui</artifactId>
   <version>3.0.0</version>
</dependency>

一旦我在所有 maven 模块中添加 spring-context-indexer 作为依赖项,swagger ui 就不再工作了

 <dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-context-indexer</artifactId>
     <version>5.2.2.RELEASE</version>
     <optional>true</optional>
 </dependency>

招摇错误

如果我从所有 maven 模块中删除 spring-context-indexer 依赖项,swagger ui 就可以工作。

我该如何解决这个问题?(如果这很重要,我们使用弹簧安全)

标签: javaspringspring-bootswagger

解决方案


有时,依赖项的最后一个版本可能与其他依赖项存在一些兼容性问题。 尝试旧版本。


推荐阅读