首页>代码>SpringBoot整合Swagger基本实现>/swagger-first/src/main/java/com/vip/swaggerfirst/config/SwaggerConfig.java
package com.vip.swaggerfirst.config; 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.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * @author vip * @Description: swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 * @Date 2019/6/15 */ @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api(){ return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).groupName("swagger测试接口") .select().apis(RequestHandlerSelectors.basePackage("com.vip.swaggerfirst.controller")) // 对所有api进行监控 .paths(PathSelectors.any()) // 对所有路径进行监控 .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() //页面标题 .title("SpringBoot整合swagger测试接口") //创建人 .contact(new Contact("vip", "", "")) //版本号 .version("1.0") //描述 .description("首个swagger API 描述") .build(); } }
最近下载更多
2410068425 LV23
1月11日
空心菜4 LV9
2023年7月16日
xiaoyuer2 LV8
2022年11月20日
MMENGDI LV14
2022年8月29日
gaotieyou LV5
2022年7月5日
1234mama LV19
2022年6月7日
壹级天灾 LV14
2022年4月27日
fangen0005 LV25
2022年4月13日
denliv_hui LV13
2022年2月9日
mengchuan6666 LV7
2022年1月7日
最近浏览更多
38735466 LV11
3月7日
Gin19960217 LV4
1月19日
2410068425 LV23
1月11日
0592lyj LV9
1月5日
edpwyg LV14
2023年10月21日
微信网友_6658069491355648 LV2
2023年10月15日
漫步的海星 LV4
2023年9月21日
空心菜4 LV9
2023年7月16日
guviva LV6
2023年3月15日
xiaoyuer2 LV8
2022年11月20日