Skip to content

Commit 8cb326a

Browse files
author
Roman Tsypuk
committed
zuul updated; services working
1 parent e755cc7 commit 8cb326a

File tree

9 files changed

+100
-9
lines changed

9 files changed

+100
-9
lines changed

api-gateway-service/src/main/resources/application.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ zuul:
55
realtor:
66
path: /realtor-service/**
77
serviceId: realtor-service
8+
client:
9+
path: /client-service/**
10+
serviceId: client-service
811

912
ignored-services: '*'

client-service/pom.xml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,28 @@
88
<version>0.0.1-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

11-
<name>client-service</name>
11+
<name>Client service</name>
1212
<description>Client service for Spring Boot</description>
1313

1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.4.RELEASE</version>
17+
<version>1.5.3.RELEASE</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2424
<java.version>1.8</java.version>
25+
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
2526
</properties>
2627

2728
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.cloud</groupId>
31+
<artifactId>spring-cloud-starter-eureka</artifactId>
32+
</dependency>
2833
<dependency>
2934
<groupId>org.springframework.boot</groupId>
3035
<artifactId>spring-boot-starter-web</artifactId>
@@ -35,8 +40,34 @@
3540
<artifactId>spring-boot-starter-test</artifactId>
3641
<scope>test</scope>
3742
</dependency>
43+
<dependency>
44+
<groupId>org.projectlombok</groupId>
45+
<artifactId>lombok</artifactId>
46+
<version>1.16.12</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.cloud</groupId>
50+
<artifactId>spring-cloud-starter-feign</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>com.lohika.jclub.storage.client</groupId>
54+
<artifactId>storage-service-client</artifactId>
55+
<version>0.0.1-SNAPSHOT</version>
56+
</dependency>
3857
</dependencies>
3958

59+
<dependencyManagement>
60+
<dependencies>
61+
<dependency>
62+
<groupId>org.springframework.cloud</groupId>
63+
<artifactId>spring-cloud-dependencies</artifactId>
64+
<version>${spring-cloud.version}</version>
65+
<type>pom</type>
66+
<scope>import</scope>
67+
</dependency>
68+
</dependencies>
69+
</dependencyManagement>
70+
4071
<build>
4172
<plugins>
4273
<plugin>
@@ -47,4 +78,4 @@
4778
</build>
4879

4980

50-
</project>
81+
</project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.lohika.jclub.client;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
import lombok.NonNull;
8+
import lombok.ToString;
9+
10+
@Builder
11+
@NoArgsConstructor
12+
@AllArgsConstructor
13+
@Data
14+
@ToString
15+
public class ApartmentRecord {
16+
@NonNull
17+
private String location;
18+
@NonNull
19+
private double price;
20+
@NonNull
21+
private double sqft;
22+
@NonNull
23+
private String phone;
24+
@NonNull
25+
private String realtorName;
26+
@NonNull
27+
private String mail;
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.lohika.jclub.client;
2+
3+
import com.lohika.jclub.storage.client.Apartment;
4+
import com.lohika.jclub.storage.client.StorageServiceClient;
5+
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.hateoas.PagedResources;
8+
import org.springframework.web.bind.annotation.GetMapping;
9+
import org.springframework.web.bind.annotation.RestController;
10+
11+
import lombok.extern.slf4j.Slf4j;
12+
13+
@Slf4j
14+
@RestController
15+
public class ClientController {
16+
17+
@Autowired
18+
private StorageServiceClient storageServiceClient;
19+
20+
@GetMapping("/apartments")
21+
public PagedResources<Apartment> getApartments() {
22+
return storageServiceClient.list();
23+
}
24+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
package com.lohika.jclub.client;
22

3+
import com.lohika.jclub.storage.client.EnableStorageServiceClient;
4+
35
import org.springframework.boot.SpringApplication;
46
import org.springframework.boot.autoconfigure.SpringBootApplication;
7+
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
8+
import org.springframework.context.annotation.Bean;
9+
import org.springframework.web.client.RestTemplate;
510

611
@SpringBootApplication
12+
@EnableStorageServiceClient
713
public class ClientServiceApplication {
814

915
public static void main(String[] args) {
1016
SpringApplication.run(ClientServiceApplication.class, args);
1117
}
18+
1219
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
spring.application.name=client-service
2-
server.port=8083
3-
spring.data.rest.return-body-on-create=true
4-
spring.data.rest.return-body-on-update=true
2+
server.port=8083

realtor-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<packaging>jar</packaging>
1010

1111
<name>Realtor service</name>
12-
<description>Demo project for Spring Boot</description>
12+
<description>Realtor for Spring Boot</description>
1313

1414
<parent>
1515
<groupId>org.springframework.boot</groupId>

realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.List;
1717

1818
@Slf4j
19-
@RestController()
19+
@RestController
2020
public class RealtorController {
2121

2222
@Autowired
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
spring.application.name=realtor-service
2-
feign.hystrix.enabled=true
2+
feign.hystrix.enabled=true

0 commit comments

Comments
 (0)