deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -34,11 +34,9 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class ApiGateway {
@Resource
private ImageClient imageClient;
@Resource private ImageClient imageClient;
@Resource
private PriceClient priceClient;
@Resource private PriceClient priceClient;
/**
* Retrieves product information that desktop clients need.
@@ -36,14 +36,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* sometime in the future) or if the location (host and port) of a microservice changes, then every
* client that makes use of those microservices must be updated.
*
* <p>The intent of the API Gateway pattern is to alleviate some of these issues. In the API
* Gateway pattern, an additional entity (the API Gateway) is placed between the client and the
* <p>The intent of the API Gateway pattern is to alleviate some of these issues. In the API Gateway
* pattern, an additional entity (the API Gateway) is placed between the client and the
* microservices. The job of the API Gateway is to aggregate the calls to the microservices. Rather
* than the client calling each microservice individually, the client calls the API Gateway a single
* time. The API Gateway then calls each of the microservices that the client needs.
*
* <p>This implementation shows what the API Gateway pattern could look like for an e-commerce
* site. The {@link ApiGateway} makes calls to the Image and Price microservices using the {@link
* <p>This implementation shows what the API Gateway pattern could look like for an e-commerce site.
* The {@link ApiGateway} makes calls to the Image and Price microservices using the {@link
* ImageClientImpl} and {@link PriceClientImpl} respectively. Customers viewing the site on a
* desktop device can see both price information and an image of a product, so the {@link
* ApiGateway} calls both of the microservices and aggregates the data in the {@link DesktopProduct}
@@ -27,21 +27,14 @@ package com.iluwatar.api.gateway;
import lombok.Getter;
import lombok.Setter;
/**
* Encapsulates all of the information that a desktop client needs to display a product.
*/
/** Encapsulates all of the information that a desktop client needs to display a product. */
@Getter
@Setter
public class DesktopProduct {
/**
* The price of the product.
*/
/** The price of the product. */
private String price;
/**
* The path to the image of the product.
*/
/** The path to the image of the product. */
private String imagePath;
}
@@ -24,9 +24,7 @@
*/
package com.iluwatar.api.gateway;
/**
* An interface used to communicate with the Image microservice.
*/
/** An interface used to communicate with the Image microservice. */
public interface ImageClient {
String getImagePath();
}
@@ -33,9 +33,7 @@ import java.net.http.HttpResponse.BodyHandlers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* An adapter to communicate with the Image microservice.
*/
/** An adapter to communicate with the Image microservice. */
@Slf4j
@Component
public class ImageClientImpl implements ImageClient {
@@ -48,10 +46,8 @@ public class ImageClientImpl implements ImageClient {
@Override
public String getImagePath() {
var httpClient = HttpClient.newHttpClient();
var httpGet = HttpRequest.newBuilder()
.GET()
.uri(URI.create("http://localhost:50005/image-path"))
.build();
var httpGet =
HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50005/image-path")).build();
try {
LOGGER.info("Sending request to fetch image path");
@@ -27,14 +27,10 @@ package com.iluwatar.api.gateway;
import lombok.Getter;
import lombok.Setter;
/**
* Encapsulates all of the information that mobile client needs to display a product.
*/
/** Encapsulates all of the information that mobile client needs to display a product. */
@Getter
@Setter
public class MobileProduct {
/**
* The price of the product.
*/
/** The price of the product. */
private String price;
}
@@ -24,9 +24,7 @@
*/
package com.iluwatar.api.gateway;
/**
* An interface used to communicate with the Price microservice.
*/
/** An interface used to communicate with the Price microservice. */
public interface PriceClient {
String getPrice();
}
@@ -33,10 +33,7 @@ import java.net.http.HttpResponse.BodyHandlers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* An adapter to communicate with the Price microservice.
*/
/** An adapter to communicate with the Price microservice. */
@Slf4j
@Component
public class PriceClientImpl implements PriceClient {
@@ -49,10 +46,8 @@ public class PriceClientImpl implements PriceClient {
@Override
public String getPrice() {
var httpClient = HttpClient.newHttpClient();
var httpGet = HttpRequest.newBuilder()
.GET()
.uri(URI.create("http://localhost:50006/price"))
.build();
var httpGet =
HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50006/price")).build();
try {
LOGGER.info("Sending request to fetch price info");