Javabaibai
小七会喷火
2021-01-26 21:21

swagger没有接口信息

  • java
  • 测试用例
  • maven
package com.djr.servicebase.config;

import com.google.common.base.Predicates;
import lombok.extern.slf4j.Slf4j;
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.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger配置类
 * @Author: 涛涛 * ^ *
 */
@Configuration
@EnableSwagger2
@Slf4j
public class SwaggerConfig {

    @Bean
    public Docket webApiConfig(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("WebAPI")
                .apiInfo(webApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.djr"))
                .paths(Predicates.not(PathSelectors.regex("/admin/.*")))
                .paths(Predicates.not(PathSelectors.regex("/error.*")))
                .build();

    }

    private ApiInfo webApiInfo(){

        return new ApiInfoBuilder()
                .title("在线教育")
                .description("涛涛-2021.01.10")
                .version("1.0")
                .contact(new Contact("java", "https://blog.csdn.net/Javabaibai?spm=1011.2124.3001.5343", "1339906213@qq.com"))
                .build();
    }
}

为什么我的这个是一个有接口信息,另一个没有呢。
而且是配置上的包我给写的了啊 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答