在Swagger配置文件中

@Configuration
@EnableSwagger2               //开启Swagger2
public class SwaggerConfig {
    @Bean
    public Docket docket1(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("A");
    }
    @Bean
    public Docket docket2(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("B");
    }
    @Bean
    public Docket docket3(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("C");
    }
    @Bean//配置了Swagger的docket的bean实例
    public Docket docket(Environment environment){
        Profiles profiles = Profiles.of("dev","test");//设置要显示的Swagger环境
        //通过acceptsProfiles判断是不是在dev环境中
        boolean b = environment.acceptsProfiles(profiles);
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("老黄")
                .enable(b)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.huang.controller"))
                .build();
    }
    //配置swagger信息apiinfo()
    private ApiInfo apiInfo(){
        Contact contact = new Contact("老黄","","943923227@qq.com");
        return new ApiInfo("Huang的Swagger的Api文档",
                "这个老黄超级帅",
                "1.0",
                "http://localhost:8080/",
                DEFAULT_CONTACT,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());
    }

}

注册多个bean的Docket类并用.groupName("xxxx")就可以实现Swagger的分组