我正在使用Swaggerfox 2.9.2
版本,我的项目中有将近100个控制器及其相应的标签。有什么办法可以创建列表并将其返回给标签?
@Configuration
@EnableSwagger2
public class SwaggerConfig{
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("AX Group")
.select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
.apis(RequestHandlerSelectors.basePackage("com.example.demo.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.tags(new Tag("Category Management", "Category Management"),
new Tag("Stock Management", "Stock Management"),
new Tag("Student Management", "Student Management"),
new Tag("Department Management", "Department Management"),
new Tag("Profile Management", "Profile Management"),
new Tag("Role Management", "Role Management"),
new Tag("Color Management", "Color Management"),
new Tag("Trip Management", "Trip Management"),
new Tag("Data Management", "Data Management"),
new Tag("Incentive Management", "Incentive Management"),
new Tag("Payment Management", "Payment Management"),
new Tag("Billing Management", "Billing Management"),
..............,
..............,
..............,
..............,
)
.globalResponseMessage(
RequestMethod.GET,
newArrayList(new ResponseMessageBuilder().code(500).message("").build()));
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("My API").version("1.0.0").build();
}
}