zoukankan      html  css  js  c++  java
  • spring boot 集成swagger2

     1  在pom.xml中加入Swagger2的依赖

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.8.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.8.0</version>
    </dependency>

    2  

    @Configuration
    @EnableSwagger2
    public class SwaggerConfig {
    
        @Bean
        public Docket createRestApi() {
            return new Docket(DocumentationType.SWAGGER_2)
                    .apiInfo(apiInfo())
                    .select()
                    .apis(RequestHandlerSelectors.basePackage("tech.duor.sunflower"))//扫描包
                    .paths(PathSelectors.any())
                    .build();
        }
    
        private ApiInfo apiInfo() {
            return new ApiInfoBuilder()
                    .title("标题")
                    .description("描述")
                    .termsOfServiceUrl("http://duor.tech/")
                    .contact("创建人")
                    .version("0.1")
                    .build();
        }
    
    }

    3 . controller

    @Api(description = "xxController", value = "描述")
    @CrossOrigin
    @RestController
    @RequestMapping("/api/system")
    //@Scope("prototype")
    public class PalletController {
    
    
    
    
        @ApiOperation(value = "查询全部的货盘分页展示", notes = "")
        @ApiImplicitParam(name = "Authorization", paramType = "header")
        @RequestMapping(value = "/pallet", method = RequestMethod.GET)
        public RestResult QueryPallets(){}
        
    }

    https://www.jianshu.com/p/8033ef83a8ed

    https://www.imooc.com/article/20521


    在浏览器中输入你配置的网址就可以访问
    http://localhost:8011/index.html

    https://www.jianshu.com/p/528b2db2ab7f

    下载  dist   放到

     修改  index.html

  • 相关阅读:
    将本地html文件拖到IE8浏览器无法打开,直接弹出一个下载的对话框
    ImageMagick
    64位win8.1系统 运行 32位程序,文件夹路径是中文遇到问题
    Dreamweaver
    JBOSS Spring Web
    spring web应用
    SQL PKG示例
    SQL分区表示例
    Java RMI 框架(远程方法调用)
    Java NIO 进程间通信
  • 原文地址:https://www.cnblogs.com/angdh/p/9910721.html
Copyright © 2011-2022 走看看