swagger皮肤版本配置

swagger配置变化原因:

SpringBoot处理映射匹配的默认策略发生变化

请求路径与 Spring MVC 处理映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser。你可以设置spring.mvc.pathmatch.matching-strategy为ant-path-matcher来改变它。

springboot 2.6.0之前

public static class Pathmatch {

private MatchingStrategy matchingStrategy = MatchingStrategy.ANT_PATH_MATCHER;

}

springboot2.6.0之后

public static class Pathmatch {

    private MatchingStrategy matchingStrategy = MatchingStrategy.PATH_PATTERN_PARSER;

}

如果升级springboot到2.6之后,需要设置spring.mvc.pathmatch.matching-strategy=ant-path-matcher来兼容Swagger2

Swagger升级

Swagger版本

1、Swagger 2.x 版本

swagger 访问路径

3.0.0之前 http://127.0.0.1:8080/swagger-ui.html

3.0.0之后 http://127.0.0.1:8080/swagger-ui/index.html

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.5.6</version>

</parent>

<dependency>

<groupId>io.springfox</groupId>

<artifactId>springfox-boot-starter</artifactId>

<version>2.6.1</version>  2.7.0  2.8.0  2.9.2  都可以

</dependency>

只需要在启动类上加 

@EnableSwagger2

访问地址:http://127.0.0.1:8080/swagger-ui.html

2、Swagger 3.x 版本

springboot 2.5.6 ✚ swagger 3.0.0配置属下

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.5.6</version>

</parent>

<dependency>

<groupId>io.springfox</groupId>

<artifactId>springfox-boot-starter</artifactId>

<version>3.0.0</version>

</dependency>

只需要在启动类上加 

@EnableSwagger2

访问地址:http://127.0.0.1:8080/swagger-ui/index.html

                                                     

springboot 2.6.5 ✚ swagger 3.0.0配置属下

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.6.5</version>

</parent>

<dependency>

<groupId>io.springfox</groupId>

<artifactId>springfox-boot-starter</artifactId>

<version>3.0.0</version>

</dependency>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值