zoukankan      html  css  js  c++  java
  • springboot 中集成 knife4j 时,报错 No mapping for GET /pdm/doc.html

    原因是项目中其他配置类继承了 WebMvcConfigurationSupport;这会导致 swagger 配置失效,将继承 WebMvcConfigurationSupport 类相关代码放在 swagger 配置类中可解决问题

    
    

    springboot版本:

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.12.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
    </parent>

    knife4j版本:

    <dependency>
    <groupId>com.github.xiaoymin</groupId>
    <artifactId>knife4j-spring-boot-starter</artifactId>
    <version>2.0.1</version>
    <exclusions>
    <exclusion>
    <artifactId>guava</artifactId>
    <groupId>com.google.guava</groupId>
    </exclusion>
    </exclusions>
    </dependency>

    swagger配置:

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/**").addResourceLocations(
    "classpath:/static/");
    registry.addResourceHandler("doc.html").addResourceLocations(
    "classpath:/META-INF/resources/");
    registry.addResourceHandler("/webjars/**").addResourceLocations(
    "classpath:/META-INF/resources/webjars/");
    }
  • 相关阅读:
    修改 dll
    SQLServer中char、varchar、nchar、nvarchar的区别:
    关于破解的一点心得
    asp.net 操作XML
    jquery autocomplete
    【转】height,posHeight和pixelHeight区别
    异常处理 Access to the path is denied
    asp.net 获得客户端 mac 地址
    cmd 跟踪路由
    Excel 宏
  • 原文地址:https://www.cnblogs.com/m2492565210/p/14845997.html
Copyright © 2011-2022 走看看