Swagger2

Swagger2

引入依赖

    
    <dependency>
        <groupId>io.springfoxgroupId>
        <artifactId>springfox-swagger2artifactId>
        <version>2.10.5version>
    dependency>

编写配置

@Configuration
public class Swagger2BizConfigure {
   

    @Resource
    private OpenApiExtensionResolver openApiExtensionResolver;

    /**
     * API文档分组配置
     **/
    @Bean(value = "bizDocApi")
    public Docket bizDocApi() {
   
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("业务功能BIZ")   // 切换的当前包下的模块名称
                        .description("业务功能BIZ")
                        .termsOfServiceUrl("https://xx.xxx.xx/")
                        .contact(new Contact("xxx","https://xx.xxx.xx/", "[email protected]"))                        .version("2.0.0")
                        .build())
                .globalResponseMessage(RequestMethod.GET, CommonResult.responseList())
                .globalResponseMessage(RequestMethod.POST

你可能感兴趣的:(Java,#,Spring,java)