首页 > 其他分享 >atools -> config -> SwaggerConfig

atools -> config -> SwaggerConfig

时间:2022-08-24 16:00:34浏览次数:48  
标签:documentation atools SwaggerConfig import springfox config

SwaggerConfig类文件

package com.example.demo.atools.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.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import static com.example.demo.atools.AtoolsConfig.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: subtlman_ljx
 * @Date: 2022/06/01/19:25
 * @Description: Swagger配置信息
 */
@Configuration
@EnableSwagger2
//@Profile({"dev","test"})
public class SwaggerConfig {


    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage(packageName))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title(titleName)
                        .description(descriptionName)
                        .version("1.0")
                        .build());
    }
}

 

标签:documentation,atools,SwaggerConfig,import,springfox,config
From: https://www.cnblogs.com/subtlman/p/16620334.html

相关文章