써먹는 웹개발

[Swagger] path 여러개를 include 하고 싶을때 본문

Server/Spring

[Swagger] path 여러개를 include 하고 싶을때

kmhan 2021. 8. 26. 16:59


728x90
반응형

1. path 한개만 쓸때

 ex) 매핑명 : api

1
2
3
4
5
6
7
return new Docket(DocumentationType.SWAGGER_2)        
        .globalRequestParameters(aParameters)
        .apiInfo(apiInfo())
        .select()
        .apis(RequestHandlerSelectors.any())
       .paths(PathSelectors.ant("/api/**"))
        .build();
cs

 

2. path 여러개 포함하고 싶을때

 ex) 매핑명 : api, apiDetail

1
2
3
4
5
6
7
return new Docket(DocumentationType.SWAGGER_2)        
        .globalRequestParameters(aParameters)
        .apiInfo(apiInfo())
        .select()
        .apis(RequestHandlerSelectors.any())
       .paths(regex("/(api|apiDetail)/.*"))
        .build();
cs

 

728x90
반응형


Comments