File tree Expand file tree Collapse file tree 4 files changed +57
-2
lines changed
src/main/java/com/cevher/ms/person Expand file tree Collapse file tree 4 files changed +57
-2
lines changed Original file line number Diff line number Diff line change 70
70
<artifactId >spring-boot-starter-test</artifactId >
71
71
<scope >test</scope >
72
72
</dependency >
73
+ <dependency >
74
+ <groupId >io.springfox</groupId >
75
+ <artifactId >springfox-swagger2</artifactId >
76
+ <version >3.0.0</version >
77
+ </dependency >
78
+
79
+ <dependency >
80
+ <groupId >io.springfox</groupId >
81
+ <artifactId >springfox-swagger-ui</artifactId >
82
+ <version >3.0.0</version >
83
+ </dependency >
73
84
74
85
</dependencies >
75
86
<dependencyManagement >
Original file line number Diff line number Diff line change
1
+ package com .cevher .ms .person .config ;
2
+
3
+
4
+ import org .springframework .context .annotation .Bean ;
5
+ import org .springframework .context .annotation .Configuration ;
6
+ import springfox .documentation .builders .ApiInfoBuilder ;
7
+ import springfox .documentation .builders .PathSelectors ;
8
+ import springfox .documentation .builders .RequestHandlerSelectors ;
9
+ import springfox .documentation .service .ApiInfo ;
10
+ import springfox .documentation .service .Contact ;
11
+ import springfox .documentation .spi .DocumentationType ;
12
+ import springfox .documentation .spring .web .plugins .Docket ;
13
+ import springfox .documentation .swagger2 .annotations .EnableSwagger2 ;
14
+
15
+ @ Configuration
16
+ @ EnableSwagger2
17
+ public class SwaggerConfig {
18
+
19
+ @ Bean
20
+ public Docket api () {
21
+ return new Docket (DocumentationType .SWAGGER_2 ).select ()
22
+ .apis (RequestHandlerSelectors .basePackage ("com.cevher.ms.person.web.rest" ))
23
+ .paths (PathSelectors .regex ("/.*" ))
24
+ .build ().apiInfo (apiEndPointsInfo ());
25
+
26
+ }
27
+
28
+ private ApiInfo apiEndPointsInfo () {
29
+ return new ApiInfoBuilder ().title ("Person Service Swagger Documentation" )
30
+ .description ("Person API Doc" )
31
+ .contact (new Contact ("Cevher Microservices" , "" , "" ))
32
+ .license ("Apache 2.0" )
33
+ .licenseUrl ("http://www.apache.org/licenses/LICENSE-2.0.html" )
34
+ .version ("1.0.0" )
35
+ .build ();
36
+ }
37
+ }
Original file line number Diff line number Diff line change 1
1
package com .cevher .ms .person .domain ;
2
2
3
3
4
+ import io .swagger .annotations .ApiModel ;
4
5
import lombok .AllArgsConstructor ;
5
6
import lombok .Data ;
6
7
import lombok .NoArgsConstructor ;
14
15
@ Data
15
16
@ AllArgsConstructor
16
17
@ NoArgsConstructor
18
+ @ ApiModel (value = "PersonDomain" , description = "Person Domain Model for person values" )
17
19
public class Person {
18
20
@ Id
19
21
@ GeneratedValue (strategy = GenerationType .AUTO )
Original file line number Diff line number Diff line change 3
3
import com .cevher .ms .person .domain .Person ;
4
4
import com .cevher .ms .person .service .PersonService ;
5
5
import com .cevher .ms .person .vm .ResponseTempVM ;
6
+ import io .swagger .annotations .Api ;
7
+ import io .swagger .annotations .ApiOperation ;
8
+ import lombok .RequiredArgsConstructor ;
6
9
import lombok .extern .slf4j .Slf4j ;
7
10
import org .springframework .beans .factory .annotation .Autowired ;
8
11
import org .springframework .web .bind .annotation .*;
12
15
@ RestController
13
16
@ RequestMapping ("/people" )
14
17
@ Slf4j
18
+ @ RequiredArgsConstructor
19
+ @ Api (value = "PersonController" , tags = {"person" , "service" })
15
20
public class PersonController {
16
21
17
- @ Autowired
18
- private PersonService personService ;
22
+ private final PersonService personService ;
19
23
24
+ @ ApiOperation (value = "savePerson" , notes = "Person Save API" , response = Person .class )
20
25
@ PostMapping ("/" )
21
26
public Person savePerson (@ RequestBody Person person ) {
22
27
log .info ("savePerson by PersonController" );
You can’t perform that action at this time.
0 commit comments