springboot2.6.x整合swagger3.0.0的空指针和后台访问

本文介绍了在SpringBoot 2.6.x版本中遇到的空指针问题及解决方案,通过在application.yml中设置spring.mvc.pathmatch.matching-strategy为ant_path_matcher来修复。同时,文章还提到了Swagger3.0.0的后台访问路径变化,现在应访问http://localhost:8080/swagger-ui/index.html进行API文档查看。


1.空指针的解决方法:在application.yml中填加

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

原因:springboot2.6.x的版本中springmvc默认路径匹配策略从ANT_PATH_MATCHER改成PATH_PATTERN_PARSER所以就有错误了,解决方法就是在配置文件中改成ANT_PATH_MATCHER模式

2.swagger3.0.0 的后台访问
从原先的http://localhost:8080/swagger-ui.html的变为http://localhost:8080/swagger-ui/index.html
源码:SpringfoxConfigurationProperties

    /**
     * Base url for swagger-ui. For e.g. setting it to /documentation will put swagger-ui
     * at /documentation/swagger-ui/index.html
     */
    private String baseUrl = "";
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值