mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 12:14:51 +00:00
* #984 Fix for abstract-document, abstract-factory, acyclic-visitor, adapter, aggregator-microservices * #984 Fix for abstract-document, abstract-factory, acyclic-visitor, adapter, aggregator-microservices
This commit is contained in:
1 parent
2217fbc5ff
commit
f00ebe1a8d
12 files changed
+33
-52
No files matched your search
+1
-1
@@ -50,7 +50,7 @@ public class Aggregator {
|
||||
*/
|
||||
@RequestMapping(path = "/product", method = RequestMethod.GET)
|
||||
public Product getProduct() {
|
||||
Product product = new Product();
|
||||
var product = new Product();
|
||||
product.setTitle(informationClient.getProductTitle());
|
||||
product.setProductInventories(inventoryClient.getProductInventories());
|
||||
return product;
|
||||
|
||||
+3
-3
@@ -43,10 +43,10 @@ public class ProductInformationClientImpl implements ProductInformationClient {
|
||||
@Override
|
||||
public String getProductTitle() {
|
||||
String response = null;
|
||||
HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build();
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build();
|
||||
var client = HttpClient.newHttpClient();
|
||||
try {
|
||||
HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
response = httpResponse.body();
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.error("IOException Occurred", ioe);
|
||||
|
||||
+4
-4
@@ -42,12 +42,12 @@ public class ProductInventoryClientImpl implements ProductInventoryClient {
|
||||
|
||||
@Override
|
||||
public int getProductInventories() {
|
||||
String response = "0";
|
||||
var response = "0";
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build();
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build();
|
||||
var client = HttpClient.newHttpClient();
|
||||
try {
|
||||
HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
response = httpResponse.body();
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.error("IOException Occurred", ioe);
|
||||
|
||||
Reference in new issue
Block a user