/*
 * 文 件 名:  Knife4jConfig
 * 版    权:
 * 描    述:  <描述>
 * 修 改 人:  RedName
 * 修改时间:  2022/8/5
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.supervision.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RestController;
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.EnableSwagger2WebMvc;

/**
 * <功能详细描述>
 *
 * @author ljt
 * @version [版本号, 2022/8/5]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {
    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(this.apiInfo())
                .useDefaultResponseMessages(false)
                .select()
            .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
            .paths(PathSelectors.any()).build();
        
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("API文档").description("API文档").contact(new Contact("", "", ""))
            .version("1.0.0").build();
    }
}
