首页>代码>spring boot集成swagger2实现用户的增删改查接口调用实例>/springboot-swwagger/src/main/java/com/singhand/Swagger2.java
package com.singhand;

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;

/**
 ************************************************* 
 * @ClassName: Swagger2 
 * @Description: TODO(Swagger2提供给前端看接口) 
 * @author mjy
 * @date 2018年5月16日 下午12:54:00 
 ************************************************
 */
@Configuration
@EnableSwagger2
public class Swagger2 {

	@Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.singhand.controller"))// 扫描com.singhand.controller包下的类
                .paths(PathSelectors.any())
                .build();
    }

    @SuppressWarnings("deprecation")
	private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("springboot集成Swagger2")
                .description("")
                .termsOfServiceUrl("")
                .contact("")
                .version("1.0")
                .build();
    }

}
最近下载更多
wsupsup  LV16 2022年9月28日
ccccccccp  LV1 2022年6月29日
lironggang  LV38 2021年11月11日
xhmpmail  LV17 2021年2月22日
zaizai21312  LV10 2020年6月12日
箫莫然  LV2 2020年6月8日
1986hxc  LV6 2020年4月24日
user42276  LV2 2020年1月19日
1813705585  LV1 2019年11月14日
wusuwu  LV11 2019年8月21日
最近浏览更多
漫步的海星  LV4 2023年9月26日
fcvgh cvx 2023年8月13日
暂无贡献等级
taoshen95  LV14 2023年5月17日
zuidaima87  LV1 2022年10月6日
wsupsup  LV16 2022年9月28日
ccccccccp  LV1 2022年6月29日
MouYa77  LV10 2022年2月18日
刘亦菲9527  LV15 2022年1月10日
Hachi6  LV13 2022年1月3日
wang512237140  LV20 2021年12月14日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友