/**
 *
 */
@Configuration
@EnableSwagger2
@Profile({"dev"}) // 指定只能在开发环境中使用
public class Swagger2Config {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.web.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    /**
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().build();
    }
}

 

相关文章:

  • 2021-12-10
  • 2021-07-01
  • 2022-12-23
  • 2021-06-16
  • 2021-07-27
  • 2021-06-29
  • 2021-09-27
  • 2021-05-20
猜你喜欢
  • 2021-09-02
  • 2022-12-23
  • 2021-05-23
  • 2021-06-17
  • 2021-12-24
  • 2022-12-23
  • 2021-05-21
相关资源
相似解决方案