首页>代码>基于SpringBoot+spring mvc+Mybatis+beetl+bootstrap实现的简洁开源网站后台管理系统Guns>/guns/guns-admin/src/main/java/com/stylefeng/guns/config/SwaggerConfig.java
package com.stylefeng.guns.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger配置类
 *
 * @author fengshuonan
 * @date 2017年6月1日19:42:59
 */
@Configuration
@EnableSwagger2
@ConditionalOnProperty(prefix = "guns", name = "swagger-open", havingValue = "true")
public class SwaggerConfig{

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))                         //这里采用包含注解的方式来确定要显示的接口
                //.apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.modular.system.controller"))    //这里采用包扫描的方式来确定要显示的接口
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Guns Doc")
                .description("Guns Api文档")
                .termsOfServiceUrl("http://git.oschina.net/naan1993/guns")
                .contact("stylefeng")
                .version("2.0")
                .build();
    }

}
最近下载更多
1158919118  LV1 2023年12月13日
hhvivi  LV2 2023年7月2日
iceboard  LV2 2023年2月26日
1114581129  LV2 2022年7月6日
2468867327  LV10 2022年5月18日
菠萝蜜  LV3 2022年4月4日
Jackson_李  LV8 2022年3月24日
刘亦菲9527  LV15 2022年1月26日
暂无贡献等级
huaua7676  LV30 2021年11月23日
最近浏览更多
林间听风  LV10 6月24日
kkkxyh  LV13 2月11日
萌了个乖乖  LV12 2024年12月26日
bluerstar  LV1 2024年10月23日
微信网友_7134912998903808  LV15 2024年8月29日
fengst 2024年6月18日
暂无贡献等级
shuangfu  LV25 2024年5月7日
微信网友_6927932988952576  LV12 2024年3月31日
yxzzxy  LV3 2024年1月19日
1158919118  LV1 2023年12月13日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友