首页>代码>基于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日
微信网友_5798314812231680
2022年1月21日
暂无贡献等级
huaua7676 LV30
2021年11月23日

最近浏览