首页>代码>spring+spring boot+mybatis+shiro+thymeleaf实现社区党务后台管理系统>/PartyAffairs/Backstage/src/main/java/com/dai/party/config/BackstageSwagger2Configuration.java
package com.dai.party.config;

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.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @program: partyAffairs
 * @description:项目后台Swagger2配置
 * @author: Dai Yuanchuan
 * @create: 2019-01-11 00:19
 **/
@Configuration
@ConditionalOnProperty(prefix = "swagger",value = {"enable"},havingValue = "true")
@EnableSwagger2
public class BackstageSwagger2Configuration {

    /**
     * SWAGR2的配置文件,其中可以配置SWAGR2的一些基本元素,如扫描包等。
     * @return
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //这里是包路径
                .apis(RequestHandlerSelectors.basePackage("com.dai.party.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    /**
     * 建立API文档的详细信息功能,注意这里引用的是哪一个。
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                //页面标题
                .title("系统后台 接口说明文档")
                .description("API 描述")
                .termsOfServiceUrl("javascript:void(0);")
                .contact(new Contact("Dai Yuanchuan", "", "novel-web@novelweb.cn"))
                .version("1.0")
                .build();
    }

}
最近下载更多
小温ggggg  LV6 2023年10月24日
爱吃鱼的猫Vital  LV6 2023年7月31日
suyuquan  LV2 2023年7月31日
happyMrLi  LV5 2023年7月31日
yunYUN123  LV1 2023年2月26日
taowufeng2  LV8 2022年12月9日
翰昌之杰2  LV6 2022年11月30日
1025490081  LV2 2022年11月9日
wylwylqq  LV6 2022年11月6日
wuying8208  LV15 2022年10月31日
最近浏览更多
刘孟飞  LV19 4月14日
泓鼎168  LV19 3月27日
wbw123  LV5 3月10日
try8023  LV18 1月22日
廖业贵  LV18 1月5日
WBelong  LV7 2023年12月27日
hhh12345  LV7 2023年12月23日
可乐123123  LV15 2023年12月20日
小芳同学  LV1 2023年12月8日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友