引入 swagger-annotations 1.5.22 排除knife4j3.0.2 中 swagger-annotations 解决依赖冲突

This commit is contained in:
niudehua 2021-03-07 21:06:39 +08:00
parent b86fb4c3f5
commit 5351917b67
2 changed files with 14 additions and 4 deletions

12
pom.xml
View File

@ -24,7 +24,8 @@
<!-- 统一依赖管理 --> <!-- 统一依赖管理 -->
<spring.boot.version>2.4.2</spring.boot.version> <spring.boot.version>2.4.2</spring.boot.version>
<!-- Web 相关 --> <!-- Web 相关 -->
<knife4j.version>2.0.8</knife4j.version> <knife4j.version>3.0.2</knife4j.version>
<swagger-annotations.version>1.5.22</swagger-annotations.version>
<!-- DB 相关 --> <!-- DB 相关 -->
<mysql-connector-java.version>5.1.46</mysql-connector-java.version> <mysql-connector-java.version>5.1.46</mysql-connector-java.version>
<druid.version>1.2.4</druid.version> <druid.version>1.2.4</druid.version>
@ -104,8 +105,17 @@
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>swagger-annotations</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<!-- DB 相关 --> <!-- DB 相关 -->
<dependency> <dependency>

View File

@ -19,7 +19,7 @@ import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -32,7 +32,7 @@ import static springfox.documentation.builders.RequestHandlerSelectors.basePacka
* @author 芋道源码 * @author 芋道源码
*/ */
@Configuration @Configuration
@EnableSwagger2WebMvc @EnableSwagger2
@EnableKnife4j @EnableKnife4j
@ConditionalOnClass({Docket.class, ApiInfoBuilder.class}) @ConditionalOnClass({Docket.class, ApiInfoBuilder.class})
@ConditionalOnProperty(prefix = "yudao.swagger", value = "enable", matchIfMissing = true) @ConditionalOnProperty(prefix = "yudao.swagger", value = "enable", matchIfMissing = true)