zoukankan      html  css  js  c++  java
  • Swagger初次使用(1分钟使用swagger)

    网上大多数博客都是千篇一律,操作非常繁琐,这里参考了一篇非常精简干练的文章:https://blog.csdn.net/u013067756/article/details/80551658

    步骤只有2步(默认程序配置的有springmvc,而且是通过maven构建)

    第一步:在spring-mvc.xml中添加如下代码:

    <bean class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration" id="swagger2Config"/>
    <mvc:resources location="classpath:/META-INF/resources/" mapping="swagger-ui.html"/>
    <mvc:resources location="classpath:/META-INF/resources/webjars/" mapping="/webjars/**"/>

    第二步:在pom.xml中添加如下代码:

     <!-- swagger -->
    <dependency>  
        <groupId>com.mangofactory</groupId>  
        <artifactId>swagger-springmvc</artifactId>  
        <version>1.0.2</version>  
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.5.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.5.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.5.1</version>
    </dependency> 
        <!--swagger-->

    第三步:访问

  • 相关阅读:
    洛谷 P4484
    洛谷 P4900
    Codeforces 1500D
    Codeforces 1322D
    2021.9.30 Codeforces 中档题四道
    BZOJ 3729
    洛谷 P6276
    Codeforces 1511G
    C语言 typedef
    C语言 回调函数 callback
  • 原文地址:https://www.cnblogs.com/thg999/p/9927117.html
Copyright © 2011-2022 走看看