File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
src/main/java/com/aj/todoapp/docs Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 25
25
<artifactId >spring-boot-actuator</artifactId >
26
26
</dependency >
27
27
28
+ <dependency >
29
+ <groupId >io.springfox</groupId >
30
+ <artifactId >springfox-swagger2</artifactId >
31
+ <version >2.5.0</version >
32
+ </dependency >
33
+
34
+ <dependency >
35
+ <groupId >io.springfox</groupId >
36
+ <artifactId >springfox-swagger-ui</artifactId >
37
+ <version >2.5.0</version >
38
+ </dependency >
39
+
28
40
<!-- <dependency> <groupId>com.aj.todoapp.data</groupId> <artifactId>todo-app-data</artifactId>
29
41
</dependency> -->
30
42
40
52
</dependency >
41
53
42
54
55
+
56
+
43
57
</dependencies >
44
58
45
59
<build >
Original file line number Diff line number Diff line change
1
+ package com .aj .todoapp .docs ;
2
+
3
+ import org .springframework .context .annotation .Bean ;
4
+ import org .springframework .context .annotation .ComponentScan ;
5
+ import org .springframework .context .annotation .Configuration ;
6
+
7
+ import com .google .common .base .Predicates ;
8
+
9
+ import springfox .documentation .builders .ApiInfoBuilder ;
10
+ import springfox .documentation .builders .PathSelectors ;
11
+ import springfox .documentation .builders .RequestHandlerSelectors ;
12
+ import springfox .documentation .service .ApiInfo ;
13
+ import springfox .documentation .spi .DocumentationType ;
14
+ import springfox .documentation .spring .web .plugins .Docket ;
15
+ import springfox .documentation .swagger2 .annotations .EnableSwagger2 ;
16
+
17
+ @ Configuration
18
+ @ EnableSwagger2
19
+ @ ComponentScan ("com.aj.todoapp.rest" )
20
+ public class SwaggerConfig {
21
+
22
+ @ Bean
23
+ public Docket api () {
24
+ return new Docket (DocumentationType .SWAGGER_2 ).select ().apis (RequestHandlerSelectors .any ())
25
+ .paths (Predicates .not (PathSelectors .regex ("/error" ))).build ().apiInfo (apiInfo ());
26
+ }
27
+
28
+ private ApiInfo apiInfo () {
29
+ return new ApiInfoBuilder ().title ("REST example" ).description ("REST example" ).termsOfServiceUrl ("github" )
30
+ .license ("Aditya" ).licenseUrl ("" ).version ("1.0" ).build ();
31
+ }
32
+
33
+ }
You can’t perform that action at this time.
0 commit comments