升级使用SpringFox的swagger-ui 3.0.0版本

说明

你的项目已经使用了sawgger2.x版本。

升级

新特性

https://github.com/springfox/springfox

NOTE: Would love feedback to make this better

  • Remove explicit dependencies on springfox-swagger2

  • Remove any @EnableSwagger2… annotations

  • Add the springfox-boot-starter dependency

  • Springfox 3.x removes dependencies on guava and other 3rd party libraries (not zero dep yet! depends on spring plugin and open api libraries for annotations and models) so if you used guava predicates/functions those will need to transition to java 8 function interfaces.

  • 移除了2.x版本的冲突版本,移除了guava等

  • 移除了@EnableSwagger2

  • 新增了springfox-boot-starter

新增了starter

删除之前的依赖,直接使用最新的starter方式。

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.1.RELEASE</version>
    </parent>


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

然后应用主类增加注解@EnableOpenApi,删除之前版本的SwaggerConfig.java,启动项目,访问地址:http://localhost:8088/swagger-ui/index.html,注意2.x版本中访问的地址的为http://localhost:8088/swagger-ui.html
在这里插入图片描述
变化还是很大的。

拦截配置

@Configuration
public class
  • 15
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值