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

atools -> config -> SwaggerConfig

作者:互联网

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,Docket,SwaggerConfig,import,springfox,config
来源: https://www.cnblogs.com/subtlman/p/16620334.html