File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
src/main/java/lk/epic/restfulAPI/config/springFoxConfig Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package lk .epic .restfulAPI .config .springFoxConfig ;
2+
3+ import org .springframework .context .annotation .Bean ;
4+ import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .web .servlet .config .annotation .ResourceHandlerRegistry ;
6+ import org .springframework .web .servlet .config .annotation .WebMvcConfigurationSupport ;
7+ import springfox .documentation .builders .PathSelectors ;
8+ import springfox .documentation .builders .RequestHandlerSelectors ;
9+ import springfox .documentation .spi .DocumentationType ;
10+ import springfox .documentation .spring .web .plugins .Docket ;
11+ import springfox .documentation .swagger2 .annotations .EnableSwagger2 ;
12+
13+ @ Configuration
14+ @ EnableSwagger2
15+ public class SpringFoxConfig extends WebMvcConfigurationSupport {
16+ @ Override
17+ public void addResourceHandlers (ResourceHandlerRegistry registry ) {
18+ registry .addResourceHandler ("swagger-ui.html" )
19+ .addResourceLocations ("classpath:/META-INF/resources/" );
20+
21+ registry .addResourceHandler ("/webjars/**" )
22+ .addResourceLocations ("classpath:/META-INF/resources/webjars/" );
23+ }
24+
25+ @ Bean
26+ public Docket api () {
27+ return new Docket (DocumentationType .SWAGGER_2 )
28+ .select ()
29+ .apis (RequestHandlerSelectors .any ())
30+ .paths (PathSelectors .any ())
31+ .build ();
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments