1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| 1 可以写一个配置类,转换到 配置类上,专门配置文档信息
@EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket docket(){ return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); }
public ApiInfo apiInfo(){ Contact xmx = new Contact("xmx", "www.xmx.com", "12@qq.com"); return new ApiInfo("swagger学习","学习swagger", "v1.0","www.xmx.com", xmx,"","",new ArrayList<>() ); } }
下面如果配置自己类的扫描信息,还是可以用自己的配置。 @Bean public Docket docket(){ return new Docket(DocumentationType.SWAGGER_2) .select().apis(RequestHandlerSelectors.any()).build().apiInfo(apiInfo()); }
看了下面再看这里。
|