Swagger 多包引入 Controller

 使用 RequestHandlerSelectors.withClassAnnotation(Api.class) 通过注解选择即可。

@Bean
public Docket Api() {
	ApiInfo apiInfo = new ApiInfoBuilder().title("XXX").description("XXX")
			.termsOfServiceUrl("urn:tos").license("Apache 2.0")
			.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0").version("1.0")
			.contact(new Contact("JCB", "https://github.com/JiangChunbo", "[email protected]")).build();
	return new Docket(DocumentationType.SWAGGER_2).groupName("Public API").apiInfo(apiInfo).select()
			.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
			.paths(PathSelectors.any()).build();
}

 

你可能感兴趣的:(Swagger)