Newer
Older
newfiber-data-adapter / src / main / java / org / springnewfiber / dataadapter / config / SwaggerConfig.java
@dongjt dongjt on 14 Jun 2022 1 KB 对接雨量数据
package org.springnewfiber.dataadapter.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
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;

/**
 * @program: newfiber-data-adapter
 * @description:
 * @author: djt
 * @create: 2022-05-18 15:50
 **/
@Configuration
@EnableSwagger2WebMvc
//@EnableKnife4j
//@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.springnewfiber.dataadapter"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("adapter- 接口文档")
                .description("前端适配器")
                .contact(new Contact("Leif Liu", null, "XXXXXX.com"))
                .version("v1.0.0")
                .build();
    }
}