Repository: JonathanM2ndoza/Hexagonal-Architecture-DDD
Branch: master
Commit: e194c6ca377c
Files: 143
Total size: 221.3 KB
Directory structure:
gitextract_phlx012v/
├── Customer/
│ ├── .gitignore
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── jmendoza/
│ │ │ └── swa/
│ │ │ └── hexagonal/
│ │ │ └── customer/
│ │ │ ├── CustomerApplication.java
│ │ │ ├── application/
│ │ │ │ ├── rest/
│ │ │ │ │ ├── controller/
│ │ │ │ │ │ └── CustomerController.java
│ │ │ │ │ ├── request/
│ │ │ │ │ │ └── README.md
│ │ │ │ │ └── response/
│ │ │ │ │ ├── CreateCustomerResponse.java
│ │ │ │ │ ├── CustomerLoginResponse.java
│ │ │ │ │ └── ResponseMapper.java
│ │ │ │ └── soap/
│ │ │ │ └── README.md
│ │ │ ├── common/
│ │ │ │ ├── config/
│ │ │ │ │ └── CreateBean.java
│ │ │ │ ├── constants/
│ │ │ │ │ └── CustomerConstanst.java
│ │ │ │ ├── customannotations/
│ │ │ │ │ └── UseCase.java
│ │ │ │ └── exception/
│ │ │ │ ├── CustomExceptionHandler.java
│ │ │ │ ├── ErrorDetails.java
│ │ │ │ ├── GlobalException.java
│ │ │ │ ├── ParameterNotFoundException.java
│ │ │ │ └── ResourceNotFoundException.java
│ │ │ ├── domain/
│ │ │ │ ├── model/
│ │ │ │ │ └── Customer.java
│ │ │ │ ├── ports/
│ │ │ │ │ ├── inbound/
│ │ │ │ │ │ ├── CreateCustomerUseCase.java
│ │ │ │ │ │ ├── CustomerLoginUseCase.java
│ │ │ │ │ │ ├── DeleteCustomerUseCase.java
│ │ │ │ │ │ └── UpdateCustomerUseCase.java
│ │ │ │ │ └── outbound/
│ │ │ │ │ ├── CreateCustomerPort.java
│ │ │ │ │ ├── DeleteCustomerPort.java
│ │ │ │ │ ├── ExistsCustomerPort.java
│ │ │ │ │ ├── GetCustomerEmailPort.java
│ │ │ │ │ ├── GetCustomerIdPort.java
│ │ │ │ │ ├── PasswordEncodePort.java
│ │ │ │ │ ├── PasswordMatchesPort.java
│ │ │ │ │ └── UpdateCustomerPort.java
│ │ │ │ └── services/
│ │ │ │ ├── CreateCustomerService.java
│ │ │ │ ├── CustomerLoginService.java
│ │ │ │ ├── DeleteCustomerService.java
│ │ │ │ └── UpdateCustomerService.java
│ │ │ └── infrastructure/
│ │ │ ├── databases/
│ │ │ │ ├── mongo/
│ │ │ │ │ ├── CreateCustomerAdapter.java
│ │ │ │ │ ├── CustomerRepository.java
│ │ │ │ │ ├── DeleteCustomerAdapter.java
│ │ │ │ │ ├── ExistsCustomerAdapter.java
│ │ │ │ │ ├── GetCustomerEmailAdapter.java
│ │ │ │ │ ├── GetCustomerIdAdapter.java
│ │ │ │ │ └── UpdateCustomerAdapter.java
│ │ │ │ └── postgresql/
│ │ │ │ └── README.md
│ │ │ ├── messagebroker/
│ │ │ │ └── README.md
│ │ │ └── security/
│ │ │ ├── PasswordEncodeAdapter.java
│ │ │ └── PasswordMatchesAdapter.java
│ │ └── resources/
│ │ ├── application.properties
│ │ └── log4j2.xml
│ └── test/
│ └── java/
│ └── com/
│ └── jmendoza/
│ └── swa/
│ └── hexagonal/
│ └── customer/
│ └── CustomerApplicationTests.java
├── Order/
│ ├── .gitignore
│ ├── README.md
│ ├── application/
│ │ ├── .gitignore
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── com/
│ │ └── jmendoza/
│ │ └── swa/
│ │ └── hexagonal/
│ │ └── application/
│ │ ├── rest/
│ │ │ ├── controller/
│ │ │ │ └── OrderController.java
│ │ │ ├── request/
│ │ │ │ └── README.md
│ │ │ └── response/
│ │ │ └── CreateOrderResponse.java
│ │ └── soap/
│ │ └── README.md
│ ├── common/
│ │ ├── .gitignore
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── com/
│ │ └── jmendoza/
│ │ └── swa/
│ │ └── hexagonal/
│ │ └── common/
│ │ ├── constants/
│ │ │ └── OrderConstanst.java
│ │ ├── customannotations/
│ │ │ └── UseCase.java
│ │ └── exception/
│ │ ├── CustomExceptionHandler.java
│ │ ├── ErrorDetails.java
│ │ ├── GlobalException.java
│ │ ├── ParameterNotFoundException.java
│ │ └── ResourceNotFoundException.java
│ ├── configuration/
│ │ ├── .gitignore
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── jmendoza/
│ │ │ └── swa/
│ │ │ └── hexagonal/
│ │ │ └── configuration/
│ │ │ ├── HexagonalArchitectureConfigurationApplication.java
│ │ │ └── db/
│ │ │ └── DataSourceConfig.java
│ │ └── resources/
│ │ ├── application.properties
│ │ └── log4j2.xml
│ ├── domain/
│ │ ├── .gitignore
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── com/
│ │ └── jmendoza/
│ │ └── swa/
│ │ └── hexagonal/
│ │ └── domain/
│ │ ├── model/
│ │ │ ├── Order.java
│ │ │ └── OrderProduct.java
│ │ ├── ports/
│ │ │ ├── inbound/
│ │ │ │ ├── CreateOrderUseCase.java
│ │ │ │ └── GetOrderUseCase.java
│ │ │ └── outbound/
│ │ │ ├── CreateOrderPort.java
│ │ │ └── GetOrderPort.java
│ │ └── services/
│ │ ├── CreateOrderService.java
│ │ └── GetOrderService.java
│ ├── infrastructure/
│ │ ├── .gitignore
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── com/
│ │ └── jmendoza/
│ │ └── swa/
│ │ └── hexagonal/
│ │ └── infrastracture/
│ │ ├── databases/
│ │ │ ├── mongo/
│ │ │ │ └── README.md
│ │ │ └── postgresql/
│ │ │ ├── CreateOrderAdapter.java
│ │ │ └── GetOrderAdapter.java
│ │ └── messagebroker/
│ │ └── README.md
│ ├── logs/
│ │ ├── Order-2020-06-05-1.log
│ │ └── Order.log
│ ├── pom.xml
│ └── postgresql/
│ ├── 1-create_table_orders.sql
│ ├── 2-create_sequence_order_id.sql
│ ├── 3-create_function_create_order.sql
│ ├── 4-create_table_order_product.sql
│ ├── 5-create_order_product_id_seq.sql
│ └── 6-create_function_get_order.sql
├── Product/
│ ├── .gitignore
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── jmendoza/
│ │ │ └── swa/
│ │ │ └── hexagonal/
│ │ │ └── product/
│ │ │ ├── ProductApplication.java
│ │ │ ├── application/
│ │ │ │ ├── rest/
│ │ │ │ │ ├── controller/
│ │ │ │ │ │ └── ProductController.java
│ │ │ │ │ ├── request/
│ │ │ │ │ │ └── README.md
│ │ │ │ │ └── response/
│ │ │ │ │ └── CreateProductResponse.java
│ │ │ │ └── soap/
│ │ │ │ └── README.md
│ │ │ ├── common/
│ │ │ │ ├── config/
│ │ │ │ │ └── README.md
│ │ │ │ ├── constants/
│ │ │ │ │ └── ProductConstanst.java
│ │ │ │ ├── customannotations/
│ │ │ │ │ └── UseCase.java
│ │ │ │ └── exception/
│ │ │ │ ├── CustomExceptionHandler.java
│ │ │ │ ├── ErrorDetails.java
│ │ │ │ ├── GlobalException.java
│ │ │ │ ├── ParameterNotFoundException.java
│ │ │ │ └── ResourceNotFoundException.java
│ │ │ ├── domain/
│ │ │ │ ├── model/
│ │ │ │ │ └── Product.java
│ │ │ │ ├── ports/
│ │ │ │ │ ├── inbound/
│ │ │ │ │ │ ├── CreateProductUseCase.java
│ │ │ │ │ │ ├── DeleteProductUseCase.java
│ │ │ │ │ │ ├── GetProductUseCase.java
│ │ │ │ │ │ └── GetProductsUseCase.java
│ │ │ │ │ └── outbound/
│ │ │ │ │ ├── CreateProductPort.java
│ │ │ │ │ ├── DeleteProductPort.java
│ │ │ │ │ ├── ExistsProductPort.java
│ │ │ │ │ ├── GetProductIdPort.java
│ │ │ │ │ └── GetProductsPort.java
│ │ │ │ └── services/
│ │ │ │ ├── CreateProductService.java
│ │ │ │ ├── DeleteProductService.java
│ │ │ │ ├── GetProductService.java
│ │ │ │ └── GetProductsService.java
│ │ │ └── infrastructure/
│ │ │ ├── databases/
│ │ │ │ ├── mongo/
│ │ │ │ │ ├── CreateProductAdapter.java
│ │ │ │ │ ├── DeleteProductAdapter.java
│ │ │ │ │ ├── ExistsProductAdapter.java
│ │ │ │ │ ├── GetProductIdAdapter.java
│ │ │ │ │ ├── GetProductsAdapter.java
│ │ │ │ │ └── ProductRepository.java
│ │ │ │ └── postgresql/
│ │ │ │ └── README.md
│ │ │ └── messagebroker/
│ │ │ └── README.md
│ │ └── resources/
│ │ ├── application.properties
│ │ └── log4j2.xml
│ └── test/
│ └── java/
│ └── com/
│ └── jmendoza/
│ └── swa/
│ └── hexagonal/
│ └── product/
│ └── ProductApplicationTests.java
├── README.md
├── logs/
│ ├── Customer.log
│ ├── Order.log
│ └── Product.log
└── prtsc/
└── Hexagonal-Architecture-Microservices.drawio
================================================
FILE CONTENTS
================================================
================================================
FILE: Customer/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Customer/README.md
================================================
# Customer Microservice
Example of Customer Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles.
This example was implemented with Spring Boot, MongoDB Atlas. The microservices are deployed locally and the DB in the cloud.
## MongoDB Atlas
- Signup free at https://www.mongodb.com/cloud/atlas/signup
- Create DATABASE and COLLECTION (Optional)
- Create Database User
- Add your IP Address (public) in IP Whitelist, Network Access


## Configure your application.properties

## Create Customer
**Postman**



**MongoDB Atlas**

## Customer Login
**Postman**

================================================
FILE: Customer/pom.xml
================================================
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.3.0.RELEASE
com.jmendoza.swa.hexagonal
customer
1.0
customer
Example of Hexagonal Architecture - Customers
1.8
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-log4j
org.projectlombok
lombok
provided
javax.validation
validation-api
2.0.0.Final
org.springframework.boot
spring-boot-starter-data-mongodb
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-actuator-autoconfigure
org.apache.commons
commons-lang3
org.modelmapper
modelmapper
2.3.5
org.springframework.boot
spring-boot-starter-log4j2
2.2.6.RELEASE
com.lmax
disruptor
3.3.6
org.zalando
logbook-spring-boot-starter
2.1.0
org.springframework.boot
spring-boot-starter-test
test
org.junit.vintage
junit-vintage-engine
org.springframework.boot
spring-boot-maven-plugin
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/CustomerApplication.java
================================================
package com.jmendoza.swa.hexagonal.customer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class}
)
public class CustomerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerApplication.class, args);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/controller/CustomerController.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.controller;
import com.jmendoza.swa.hexagonal.customer.application.rest.response.CreateCustomerResponse;
import com.jmendoza.swa.hexagonal.customer.application.rest.response.CustomerLoginResponse;
import com.jmendoza.swa.hexagonal.customer.application.rest.response.ResponseMapper;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CreateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CustomerLoginUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.DeleteCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.UpdateCustomerUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequestMapping("/v1/customers")
@AllArgsConstructor
public class CustomerController {
private final CreateCustomerUseCase createCustomerUseCase;
private final CustomerLoginUseCase customerLoginUseCase;
private final DeleteCustomerUseCase deleteCustomerUseCase;
private final UpdateCustomerUseCase updateCustomerUseCase;
private final ResponseMapper responseMapper;
@PostMapping
public ResponseEntity createCustomer(@Valid @RequestBody Customer customer) throws GlobalException, ParameterNotFoundException {
createCustomerUseCase.createCustomer(customer);
return ResponseEntity.ok().body(CreateCustomerResponse.builder().id(customer.getId()).build());
}
@PostMapping("/login")
public ResponseEntity customerLogin(@Valid @RequestBody Customer customer) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException {
CustomerLoginResponse customerLoginResponse = responseMapper.convertCustomerToCustomerLoginResponse(customerLoginUseCase.customerLogin(customer.getEmail(), customer.getPassword()));
return ResponseEntity.ok().body(customerLoginResponse);
}
@DeleteMapping("/{id}")
public ResponseEntity deleteCustomer(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
deleteCustomerUseCase.deleteCustomer(id);
return ResponseEntity.noContent().build();
}
@PutMapping("/{id}")
public ResponseEntity updateCustomer(@PathVariable(value = "id") String id,
@Valid @RequestBody Customer customer) throws ResourceNotFoundException {
updateCustomerUseCase.updateCustomer(id, customer);
return ResponseEntity.noContent().build();
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateUserRequest.*
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CreateCustomerResponse.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateCustomerResponse {
private String id;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/CustomerLoginResponse.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomerLoginResponse {
private String id;
private String firstName;
private String lastName;
private String email;
private String createdAt;
private String updatedAt;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/rest/response/ResponseMapper.java
================================================
package com.jmendoza.swa.hexagonal.customer.application.rest.response;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ResponseMapper {
@Autowired
ModelMapper modelMapper;
public CustomerLoginResponse convertCustomerToCustomerLoginResponse(Customer customer) {
return modelMapper.map(customer, CustomerLoginResponse.class);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a CustomerController class to expose SOAP.*
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/config/CreateBean.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.config;
import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CreateBean {
@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/constants/CustomerConstanst.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.constants;
public class CustomerConstanst {
public static final String CUSTOMER_NOT_FOUND = "Customer not found :: ";
public static final String THIS_EMAIL_IS_ALREADY_REGISTERED = "This email is already registered ";
public static final String THE_PASSWORD_IS_INCORRECT = "The password is incorrect ";
public static final String REQUIRED_PARAMETER = "Required parameter ";
public static final String IS_NOT_PRESENT = " is not present";
private CustomerConstanst() {
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.customannotations;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {
@AliasFor(annotation = Component.class)
String value() default "";
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import java.util.Date;
@ControllerAdvice
public class CustomExceptionHandler {
private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
}
@ExceptionHandler({GlobalException.class})
public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
}
@ExceptionHandler({ParameterNotFoundException.class})
public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Date;
@Getter
@AllArgsConstructor
public class ErrorDetails {
private Date timestamp;
private String message;
private String details;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
private static final long serialVersionUID = 1L;
public GlobalException(String message) {
super(message);
}
public GlobalException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ParameterNotFoundException(String message) {
super(message);
}
public ParameterNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.customer.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ResourceNotFoundException(String message) {
super(message);
}
public ResourceNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/model/Customer.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class Customer {
private String id;
private String firstName;
private String lastName;
private String email;
private String password;
private String createdAt;
private String updatedAt;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CreateCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface CreateCustomerUseCase {
void createCustomer(Customer customer) throws GlobalException, ParameterNotFoundException;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/CustomerLoginUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface CustomerLoginUseCase {
Customer customerLogin(String email, String password) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/DeleteCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
public interface DeleteCustomerUseCase {
void deleteCustomer(String id) throws ResourceNotFoundException;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/inbound/UpdateCustomerUseCase.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface UpdateCustomerUseCase {
void updateCustomer(String id, Customer customer) throws ResourceNotFoundException;
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/CreateCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface CreateCustomerPort {
void createCustomer(Customer customer);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/DeleteCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface DeleteCustomerPort {
void deleteCustomer(Customer customer);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/ExistsCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
public interface ExistsCustomerPort {
boolean existsByEmail(String email);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerEmailPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import java.util.Optional;
public interface GetCustomerEmailPort {
Optional getCustomerByEmail(String email);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/GetCustomerIdPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import java.util.Optional;
public interface GetCustomerIdPort {
Optional getCustomerById(String id);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordEncodePort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
public interface PasswordEncodePort {
String passwordEncoder(String password);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/PasswordMatchesPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
public interface PasswordMatchesPort {
boolean passwordMatchesPort(CharSequence rawPassword, String encodedPassword);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/ports/outbound/UpdateCustomerPort.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
public interface UpdateCustomerPort {
void updateCustomer(Customer customer);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CreateCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;
import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CreateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.CreateCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.ExistsCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@AllArgsConstructor
@UseCase
public class CreateCustomerService implements CreateCustomerUseCase {
private CreateCustomerPort createCustomerPort;
private PasswordEncodePort passwordEncodePort;
private ExistsCustomerPort existsCustomerPort;
@Override
public void createCustomer(Customer customer) throws GlobalException, ParameterNotFoundException {
if (StringUtils.isBlank(customer.getFirstName()))
getMessageParameterNotFoundException("firstName");
if (StringUtils.isBlank(customer.getLastName()))
getMessageParameterNotFoundException("lastName");
if (StringUtils.isBlank(customer.getEmail()))
getMessageParameterNotFoundException("email");
if (StringUtils.isBlank(customer.getPassword()))
getMessageParameterNotFoundException("password");
if (StringUtils.isBlank(customer.getCreatedAt()))
getMessageParameterNotFoundException("createdAt");
if (existsCustomerPort.existsByEmail(customer.getEmail()))
throw new GlobalException(CustomerConstanst.THIS_EMAIL_IS_ALREADY_REGISTERED);
customer.setPassword(passwordEncodePort.passwordEncoder(customer.getPassword()));
createCustomerPort.createCustomer(customer);
}
private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
throw new ParameterNotFoundException(CustomerConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + CustomerConstanst.IS_NOT_PRESENT);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/CustomerLoginService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;
import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.CustomerLoginUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerEmailPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordMatchesPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.util.Optional;
@AllArgsConstructor
@UseCase
public class CustomerLoginService implements CustomerLoginUseCase {
private GetCustomerEmailPort getCustomerEmailPort;
private PasswordMatchesPort passwordMatchesPort;
@Override
public Customer customerLogin(String email, String password) throws ResourceNotFoundException, GlobalException, ParameterNotFoundException {
if (StringUtils.isBlank(email))
getMessageParameterNotFoundException("email");
if (StringUtils.isBlank(password))
getMessageParameterNotFoundException("password");
Optional customerOptional;
Customer customer = null;
customerOptional = Optional.ofNullable(getCustomerEmailPort.getCustomerByEmail(email).orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + email)));
if (customerOptional.isPresent()) {
customer = customerOptional.get();
if (!passwordMatchesPort.passwordMatchesPort(password, customer.getPassword()))
throw new GlobalException(CustomerConstanst.THE_PASSWORD_IS_INCORRECT);
customer.setPassword(StringUtils.EMPTY);
}
return customer;
}
private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
throw new ParameterNotFoundException(CustomerConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + CustomerConstanst.IS_NOT_PRESENT);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/DeleteCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;
import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.DeleteCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.DeleteCustomerPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@UseCase
public class DeleteCustomerService implements DeleteCustomerUseCase {
private GetCustomerIdPort getCustomerIdPort;
private DeleteCustomerPort deleteCustomerPort;
@Override
public void deleteCustomer(String id) throws ResourceNotFoundException {
Customer customer = getCustomerIdPort.getCustomerById(id)
.orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + id));
deleteCustomerPort.deleteCustomer(customer);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/domain/services/UpdateCustomerService.java
================================================
package com.jmendoza.swa.hexagonal.customer.domain.services;
import com.jmendoza.swa.hexagonal.customer.common.constants.CustomerConstanst;
import com.jmendoza.swa.hexagonal.customer.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.customer.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.inbound.UpdateCustomerUseCase;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.UpdateCustomerPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.modelmapper.Conditions;
import org.modelmapper.ModelMapper;
@AllArgsConstructor
@UseCase
public class UpdateCustomerService implements UpdateCustomerUseCase {
private GetCustomerIdPort getCustomerIdPort;
private UpdateCustomerPort updateCustomerPort;
private PasswordEncodePort passwordEncodePort;
private ModelMapper modelMapper;
@Override
public void updateCustomer(String id, Customer customer) throws ResourceNotFoundException {
Customer customer1 = getCustomerIdPort.getCustomerById(id)
.orElseThrow(() -> new ResourceNotFoundException(CustomerConstanst.CUSTOMER_NOT_FOUND + id));
if (!StringUtils.isBlank(customer.getPassword()))
customer.setPassword(passwordEncodePort.passwordEncoder(customer.getPassword()));
customer.setId(id);
modelMapper.getConfiguration().setPropertyCondition(Conditions.isNotNull());
modelMapper.map(customer, customer1);
updateCustomerPort.updateCustomer(customer1);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CreateCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.CreateCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CreateCustomerAdapter implements CreateCustomerPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public void createCustomer(Customer customer) {
customerRepository.save(customer);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/CustomerRepository.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface CustomerRepository extends MongoRepository {
boolean existsByEmail(String email);
Optional findByEmail(String email);
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/DeleteCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.DeleteCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DeleteCustomerAdapter implements DeleteCustomerPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public void deleteCustomer(Customer customer) {
customerRepository.delete(customer);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/ExistsCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.ExistsCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ExistsCustomerAdapter implements ExistsCustomerPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public boolean existsByEmail(String email) {
return customerRepository.existsByEmail(email);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerEmailAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerEmailPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
@Component
public class GetCustomerEmailAdapter implements GetCustomerEmailPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public Optional getCustomerByEmail(String email) {
return customerRepository.findByEmail(email);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/GetCustomerIdAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.GetCustomerIdPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
@Component
public class GetCustomerIdAdapter implements GetCustomerIdPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public Optional getCustomerById(String id) {
return customerRepository.findById(id);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/mongo/UpdateCustomerAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.customer.domain.model.Customer;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.UpdateCustomerPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UpdateCustomerAdapter implements UpdateCustomerPort {
@Autowired
private CustomerRepository customerRepository;
@Override
public void updateCustomer(Customer customer) {
customerRepository.save(customer);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/databases/postgresql/README.md
================================================
*In this directory you can add another type of DB adapter for example PostgreSQL.*
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordEncodeAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.security;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordEncodePort;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
@Component
public class PasswordEncodeAdapter implements PasswordEncodePort {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
@Override
public String passwordEncoder(String password) {
return bCryptPasswordEncoder.encode(password);
}
}
================================================
FILE: Customer/src/main/java/com/jmendoza/swa/hexagonal/customer/infrastructure/security/PasswordMatchesAdapter.java
================================================
package com.jmendoza.swa.hexagonal.customer.infrastructure.security;
import com.jmendoza.swa.hexagonal.customer.domain.ports.outbound.PasswordMatchesPort;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
@Component
public class PasswordMatchesAdapter implements PasswordMatchesPort {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
@Override
public boolean passwordMatchesPort(CharSequence rawPassword, String encodedPassword) {
return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
}
}
================================================
FILE: Customer/src/main/resources/application.properties
================================================
# Application Server
server.port=3000
# MongoDB Atlas
spring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@cluster0-7rxkw.mongodb.net/customer?retryWrites=true&w=majority&connectTimeoutMS=60000
# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE
================================================
FILE: Customer/src/main/resources/log4j2.xml
================================================
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ==> %m%n
${LOG_PATTERN}
================================================
FILE: Customer/src/test/java/com/jmendoza/swa/hexagonal/customer/CustomerApplicationTests.java
================================================
package com.jmendoza.swa.hexagonal.customer;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CustomerApplicationTests {
@Test
void contextLoads() {
}
}
================================================
FILE: Order/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/README.md
================================================
# Orders Microservice
Example of Orders Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles. I recommend using this Multiple Modules structure to decouple the code. In this way, part of the code can be migrated to another project in the future.
This example was implemented with Spring Boot, PostgreSQL. The microservices and the DB are deployed locally.
### Start a PostgreSQL Server
1. Start a PostgreSQL server instance with Docker Hub
```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker run -d --name postgres -e POSTGRES_PASSWORD=root.jmtizure.k201 postgres
```
2. Start pgAdmin 4 (Container), is a GUI client for PostgreSQL
```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker run --name pgadmin4 -p 5050:80 -e "PGADMIN_DEFAULT_EMAIL=jmtizure@gmail.com" -e "PGADMIN_DEFAULT_PASSWORD=123456789" -d dpage/pgadmin4
```


3. Create a new "customers" database

4. Execute the following scripts in the public schema.

## Configure your application.properties
Find the IP address of your postgres container
```shell
jmendoza@jmendoza-ThinkPad-T420:~$ docker inspect postgres
```


## Create Order
**Postman**

```shell
[2020-06-03 22:35:27.350] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ab783ac9bce46b82","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["32678e26-1a2d-450e-865d-5ea8429540ac"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-06-03 22:35:27.513] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ab783ac9bce46b82","duration":255,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Thu, 04 Jun 2020 02:35:27 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"31"}}
```
**PostgreSQL**


## Get Orders
**Postman**

**PostgreSQL**


```shell
[2020-06-04 21:52:50.882] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"91d731033f99fbed","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/33","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["8fe08c78-dcb0-9f1e-a0a8-62f731d232a4"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:52:50.893] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"91d731033f99fbed","duration":11,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:52:50 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":13,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":14,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
```
================================================
FILE: Order/application/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/application/pom.xml
================================================
4.0.0
com.jmendoza.swa.hexagonal
order
1.0
application
1.0
jar
hexagonal-architecture-application
Example of Hexagonal Architecture - Application
com.jmendoza.swa.hexagonal
domain
1.0
================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.java
================================================
package com.jmendoza.swa.hexagonal.application.rest.controller;
import com.jmendoza.swa.hexagonal.application.rest.response.CreateOrderResponse;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.CreateOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.GetOrderUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequestMapping("/v1/orders")
@AllArgsConstructor
public class OrderController {
private final CreateOrderUseCase createOrderUseCase;
private final GetOrderUseCase getOrderUseCase;
@PostMapping
public ResponseEntity createOrder(@Valid @RequestBody Order order) throws ParameterNotFoundException, GlobalException {
createOrderUseCase.createOrder(order);
return ResponseEntity.ok().body(CreateOrderResponse.builder().orderId(order.getOrderId()).build());
}
@GetMapping("/{id}")
public ResponseEntity getOrder(@PathVariable(value = "id") String id) throws ResourceNotFoundException, GlobalException {
return ResponseEntity.ok().body(getOrderUseCase.getOrder(id));
}
}
================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateOrderRequest.*
================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/rest/response/CreateOrderResponse.java
================================================
package com.jmendoza.swa.hexagonal.application.rest.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateOrderResponse {
private String orderId;
}
================================================
FILE: Order/application/src/main/java/com/jmendoza/swa/hexagonal/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a OrderController class to expose SOAP.*
================================================
FILE: Order/common/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/common/pom.xml
================================================
4.0.0
com.jmendoza.swa.hexagonal
order
1.0
common
1.0
jar
hexagonal-architecture-common
Example of Hexagonal Architecture - Common
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/constants/OrderConstanst.java
================================================
package com.jmendoza.swa.hexagonal.common.constants;
public class OrderConstanst {
public static final String ORDER_NOT_FOUND = "Order not found :: ";
public static final String REQUIRED_PARAMETER = "Required parameter ";
public static final String IS_NOT_PRESENT = " is not present";
public static final String ORDERS_NOT_FOUND = "Orders not found";
private OrderConstanst() {
}
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.common.customannotations;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {
@AliasFor(annotation = Component.class)
String value() default "";
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import java.util.Date;
@ControllerAdvice
public class CustomExceptionHandler {
private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
}
@ExceptionHandler({GlobalException.class})
public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
}
@ExceptionHandler({ParameterNotFoundException.class})
public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
}
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Date;
@Getter
@AllArgsConstructor
public class ErrorDetails {
private Date timestamp;
private String message;
private String details;
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
private static final long serialVersionUID = 1L;
public GlobalException(String message) {
super(message);
}
public GlobalException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ParameterNotFoundException(String message) {
super(message);
}
public ParameterNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Order/common/src/main/java/com/jmendoza/swa/hexagonal/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ResourceNotFoundException(String message) {
super(message);
}
public ResourceNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Order/configuration/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/configuration/pom.xml
================================================
4.0.0
com.jmendoza.swa.hexagonal
order
1.0
configuration
1.0
hexagonal-architecture-configuration
Example of Hexagonal Architecture - Configuration
com.jmendoza.swa.hexagonal
application
1.0
com.jmendoza.swa.hexagonal
infrastructure
1.0
org.zalando
logbook-spring-boot-starter
2.1.0
================================================
FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/HexagonalArchitectureConfigurationApplication.java
================================================
package com.jmendoza.swa.hexagonal.configuration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.jmendoza.swa.hexagonal.*"})
public class HexagonalArchitectureConfigurationApplication {
public static void main(String[] args) {
SpringApplication.run(HexagonalArchitectureConfigurationApplication.class, args);
}
}
================================================
FILE: Order/configuration/src/main/java/com/jmendoza/swa/hexagonal/configuration/db/DataSourceConfig.java
================================================
package com.jmendoza.swa.hexagonal.configuration.db;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
public class DataSourceConfig {
@Bean
@Primary
@ConfigurationProperties("spring.datasource.tomcat")
public DataSource getDataSource(Environment env) {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
final Properties properties = new Properties();
dataSource.setDriverClassName(env.getProperty("spring.datasource.driverClassName"));
dataSource.setUrl(env.getProperty("spring.datasource.url"));
dataSource.setUsername(env.getProperty("spring.datasource.username"));
dataSource.setPassword(env.getProperty("spring.datasource.password"));
properties.setProperty("initialSize", env.getProperty("spring.datasource.tomcat.initial-size"));
properties.setProperty("minIdle", env.getProperty("spring.datasource.tomcat.min-idle"));
properties.setProperty("maxActive", env.getProperty("spring.datasource.tomcat.max-active"));
properties.setProperty("maxIdle", env.getProperty("spring.datasource.tomcat.max-idle"));
properties.setProperty("minEvictableIdleTimeMillis", env.getProperty("spring.datasource.tomcat.min-evictable-idle-time-millis"));
properties.setProperty("maxWait", env.getProperty("spring.datasource.tomcat.max-idle"));
dataSource.setConnectionProperties(properties);
return dataSource;
}
}
================================================
FILE: Order/configuration/src/main/resources/application.properties
================================================
## Server
server.port=3002
## Spring DATASOURCE
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://172.17.0.2:5432/customers
spring.datasource.username=postgres
spring.datasource.password=root.jmtizure.k201
spring.datasource.tomcat.initial-size=15
spring.datasource.tomcat.min-idle=15
spring.datasource.tomcat.max-active=50
spring.datasource.tomcat.max-idle=50
spring.datasource.tomcat.min-evictable-idle-time-millis=60000
spring.datasource.tomcat.max-wait=20000
# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE
================================================
FILE: Order/configuration/src/main/resources/log4j2.xml
================================================
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ===> %m%n
${LOG_PATTERN}
================================================
FILE: Order/domain/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/domain/pom.xml
================================================
4.0.0
com.jmendoza.swa.hexagonal
order
1.0
domain
1.0
jar
hexagonal-architecture-domain
Example of Hexagonal Architecture - Domain
com.jmendoza.swa.hexagonal
common
1.0
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/Order.java
================================================
package com.jmendoza.swa.hexagonal.domain.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Date;
import java.util.List;
@Getter
@Setter
@ToString
public class Order {
private String orderId;
private String customerId;
private Date createdAt;
private List orderProductList;
private Double amountOrder;
public Double getAmountOrder() {
return orderProductList.stream().mapToDouble(OrderProduct::getAmount).sum();
}
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/model/OrderProduct.java
================================================
package com.jmendoza.swa.hexagonal.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
@Getter
@Setter
@ToString
@AllArgsConstructor
public class OrderProduct implements Serializable {
private static final long serialVersionUID = 1L;
private int orderProductId;
private int quantity;
private String productId;
private Double productPrice;
Double getAmount() {
return productPrice.doubleValue() * this.getQuantity();
}
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/CreateOrderUseCase.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
public interface CreateOrderUseCase {
void createOrder(Order order) throws ParameterNotFoundException, GlobalException;
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/inbound/GetOrderUseCase.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
public interface GetOrderUseCase {
Order getOrder(String orderId) throws ResourceNotFoundException, GlobalException;
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/CreateOrderPort.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
public interface CreateOrderPort {
void createOrder(Order order) throws GlobalException;
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/ports/outbound/GetOrderPort.java
================================================
package com.jmendoza.swa.hexagonal.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
public interface GetOrderPort {
Order getOrder(String orderId) throws GlobalException;
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.java
================================================
package com.jmendoza.swa.hexagonal.domain.services;
import com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;
import com.jmendoza.swa.hexagonal.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.CreateOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@AllArgsConstructor
@UseCase
public class CreateOrderService implements CreateOrderUseCase {
private CreateOrderPort createOrderPort;
@Override
public void createOrder(Order order) throws ParameterNotFoundException, GlobalException {
try {
if (StringUtils.isBlank(order.getCustomerId()))
getMessageParameterNotFoundException("customerId");
if (order.getCreatedAt() == null)
getMessageParameterNotFoundException("createdAt");
if (order.getOrderProductList() == null || order.getOrderProductList().isEmpty())
getMessageParameterNotFoundException("orderProductList");
//TODO: pending validate orderProductList
createOrderPort.createOrder(order);
} catch (Exception e) {
throw new GlobalException("createOrder: " + e.getMessage());
}
}
private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
throw new ParameterNotFoundException(OrderConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + OrderConstanst.IS_NOT_PRESENT);
}
}
================================================
FILE: Order/domain/src/main/java/com/jmendoza/swa/hexagonal/domain/services/GetOrderService.java
================================================
package com.jmendoza.swa.hexagonal.domain.services;
import com.jmendoza.swa.hexagonal.common.constants.OrderConstanst;
import com.jmendoza.swa.hexagonal.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.inbound.GetOrderUseCase;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.GetOrderPort;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@UseCase
public class GetOrderService implements GetOrderUseCase {
private GetOrderPort getOrderPort;
@Override
public Order getOrder(String orderId) throws ResourceNotFoundException, GlobalException {
try {
final Order order = getOrderPort.getOrder(orderId);
if (order == null)
throw new ResourceNotFoundException(OrderConstanst.ORDER_NOT_FOUND + orderId);
return order;
} catch (Exception e) {
throw new GlobalException("getOrder: " + e.getMessage());
}
}
}
================================================
FILE: Order/infrastructure/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Order/infrastructure/pom.xml
================================================
4.0.0
com.jmendoza.swa.hexagonal
order
1.0
infrastructure
1.0
jar
hexagonal-architecture-infrastructure
Example of Hexagonal Architecture - Infrastructure
com.jmendoza.swa.hexagonal
domain
1.0
org.springframework.boot
spring-boot-starter-data-jdbc
com.zaxxer
HikariCP
org.postgresql
postgresql
================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/mongo/README.md
================================================
*In this directory you can add another type of DB adapter for example Mongo.*
================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/CreateOrderAdapter.java
================================================
package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;
import com.google.gson.Gson;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
@Component
public class CreateOrderAdapter implements CreateOrderPort {
private JdbcTemplate jdbcTemplate;
@Autowired
public CreateOrderAdapter(final DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public void createOrder(Order order) throws GlobalException {
final String procedureCall = "{ ? = call create_order(?, ?, ?, ?)}";
try (Connection connection = jdbcTemplate.getDataSource().getConnection();
CallableStatement callableStatement = connection.prepareCall(procedureCall)
) {
Gson gson = new Gson();
String json = gson.toJson(order.getOrderProductList());
callableStatement.registerOutParameter(1, Types.BIGINT);
callableStatement.setString(2, order.getCustomerId());
callableStatement.setTimestamp(3, new java.sql.Timestamp(order.getCreatedAt().getTime()));
callableStatement.setDouble(4, order.getAmountOrder());
callableStatement.setString(5, json);
callableStatement.execute();
order.setOrderId(Long.toString(callableStatement.getLong(1)));
} catch (Exception e) {
throw new GlobalException("Exception createOrder: " + e.getMessage());
}
}
}
================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/databases/postgresql/GetOrderAdapter.java
================================================
package com.jmendoza.swa.hexagonal.infrastracture.databases.postgresql;
import com.google.gson.Gson;
import com.jmendoza.swa.hexagonal.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.domain.model.Order;
import com.jmendoza.swa.hexagonal.domain.ports.outbound.GetOrderPort;
import org.postgresql.util.PGobject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
@Component
public class GetOrderAdapter implements GetOrderPort {
private JdbcTemplate jdbcTemplate;
@Autowired
public GetOrderAdapter(final DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public Order getOrder(String orderId) throws GlobalException {
final String procedureCall = "{ ? = call get_order(?)}";
Order order = null;
try (Connection connection = jdbcTemplate.getDataSource().getConnection();
CallableStatement callableStatement = connection.prepareCall(procedureCall)
) {
PGobject pGobject;
callableStatement.registerOutParameter(1, Types.OTHER);
callableStatement.setLong(2, Long.parseLong(orderId));
callableStatement.execute();
pGobject = (PGobject) callableStatement.getObject(1);
if (pGobject != null) {
Gson gson = new Gson();
order = gson.fromJson(pGobject.toString(), Order.class);
}
} catch (Exception e) {
throw new GlobalException("Exception getOrder: " + e.getMessage());
}
return order;
}
}
================================================
FILE: Order/infrastructure/src/main/java/com/jmendoza/swa/hexagonal/infrastracture/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*
================================================
FILE: Order/logs/Order-2020-06-05-1.log
================================================
[2020-06-05 23:59:49.755] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 12245 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-06-05 23:59:49.773] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-06-05 23:59:50.885] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-05 23:59:50.905] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 16ms. Found 0 JDBC repository interfaces.
[2020-06-05 23:59:51.469] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-05 23:59:51.479] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-05 23:59:51.480] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-05 23:59:51.481] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-05 23:59:51.592] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-05 23:59:51.593] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1550 ms
[2020-06-05 23:59:51.938] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-05 23:59:52.237] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-05 23:59:52.439] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-05 23:59:52.615] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-05 23:59:52.692] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-05 23:59:52.712] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Started HexagonalArchitectureConfigurationApplication in 3.799 seconds (JVM running for 5.472)
================================================
FILE: Order/logs/Order.log
================================================
[2020-09-18 18:46:56.843] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 31880 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:46:57.023] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-09-18 18:46:58.392] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:46:58.425] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 26ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:46:59.341] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:46:59.366] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:46:59.367] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-09-18 18:46:59.368] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:46:59.564] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-09-18 18:46:59.565] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2475 ms
[2020-09-18 18:46:59.889] [WARN] [jmendoza-ThinkPad-T420] [main] [servlet.context.AnnotationConfigServletWebServerApplicationContext] | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderController' defined in file [/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/application/target/classes/com/jmendoza/swa/hexagonal/application/rest/controller/OrderController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'createOrderService' defined in file [/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/domain/target/classes/com/jmendoza/swa/hexagonal/domain/services/CreateOrderService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[2020-09-18 18:46:59.895] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Stopping service [Tomcat]
[2020-09-18 18:46:59.929] [INFO] [jmendoza-ThinkPad-T420] [main] [autoconfigure.logging.ConditionEvaluationReportLoggingListener] |
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[2020-09-18 18:47:00.165] [ERROR] [jmendoza-ThinkPad-T420] [main] [boot.diagnostics.LoggingFailureAnalysisReporter] |
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.jmendoza.swa.hexagonal.domain.services.CreateOrderService required a bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' that could not be found.
Action:
Consider defining a bean of type 'com.jmendoza.swa.hexagonal.domain.ports.outbound.CreateOrderPort' in your configuration.
[2020-09-18 18:47:00.168] [WARN] [jmendoza-ThinkPad-T420] [main] [springframework.boot.SpringApplication] | Unable to close ApplicationContext
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at com.jmendoza.swa.hexagonal.configuration.HexagonalArchitectureConfigurationApplication.main(HexagonalArchitectureConfigurationApplication.java:10) [classes/:?]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:603) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
... 28 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessBeforeInitialization(ConfigurationClassPostProcessor.java:456) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:409) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:109) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:94) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:76) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:347) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
... 28 more
[2020-09-18 18:48:24.419] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 32302 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:48:24.437] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | No active profile set, falling back to default profiles: default
[2020-09-18 18:48:25.832] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:48:25.859] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 21ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:48:26.638] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:48:26.652] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:48:26.653] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-09-18 18:48:26.669] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:48:26.773] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-09-18 18:48:26.774] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2003 ms
[2020-09-18 18:48:27.296] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:48:27.655] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-09-18 18:48:27.963] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-09-18 18:48:28.195] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:48:28.279] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 18:48:28.293] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] | Started HexagonalArchitectureConfigurationApplication in 4.93 seconds (JVM running for 6.902)
[2020-09-18 18:53:33.328] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:53:33.330] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-09-18 18:53:33.343] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-09-18 18:53:59.925] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 32731 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 18:53:59.973] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> No active profile set, falling back to default profiles: default
[2020-09-18 18:54:01.235] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 18:54:01.262] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Finished Spring Data repository scanning in 22ms. Found 0 JDBC repository interfaces.
[2020-09-18 18:54:02.009] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat initialized with port(s): 3002 (http)
[2020-09-18 18:54:02.022] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:54:02.023] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] ===> Starting service [Tomcat]
[2020-09-18 18:54:02.023] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] ===> Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 18:54:02.115] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] ===> Initializing Spring embedded WebApplicationContext
[2020-09-18 18:54:02.115] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] ===> Root WebApplicationContext: initialization completed in 1863 ms
[2020-09-18 18:54:02.541] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:54:02.780] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Starting...
[2020-09-18 18:54:02.994] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Start completed.
[2020-09-18 18:54:03.139] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 18:54:03.174] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 18:54:03.189] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Started HexagonalArchitectureConfigurationApplication in 3.973 seconds (JVM running for 5.737)
[2020-09-18 18:55:19.058] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] ===> Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-09-18 18:55:19.059] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Initializing Servlet 'dispatcherServlet'
[2020-09-18 18:55:19.109] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Completed initialization in 49 ms
[2020-09-18 18:55:19.415] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"e7f998e53c885f2d","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["ac8ea573-8463-712c-1cd5-8c575789dbc3"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-09-18 18:55:19.876] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"e7f998e53c885f2d","duration":682,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:19 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36"}}
[2020-09-18 18:55:43.478] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"90a2cd79829db3ea","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["31da7306-62b6-22f8-37e0-2a251f892506"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:43.526] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"90a2cd79829db3ea","duration":48,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:43 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 18:55:49.901] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"9e2e64d736239f87","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["f9b7108d-6dd7-a3a8-acf5-57fed7be75f8"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:49.924] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [common.exception.CustomExceptionHandler] ===> com.jmendoza.swa.hexagonal.common.exception.GlobalException: getOrder: Order not found :: 37
[2020-09-18 18:55:49.930] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"9e2e64d736239f87","duration":30,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:49 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-09-18T22:55:49.924+00:00","message":"getOrder: Order not found :: 37","details":"uri=/v1/orders/37"}}
[2020-09-18 18:55:57.137] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"8646799f85278cc7","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["676e731d-bfde-122b-485a-c0d11ebfca11"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 18:55:57.145] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"8646799f85278cc7","duration":9,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 22:55:57 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 18:57:04.151] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Shutting down ExecutorService 'applicationTaskExecutor'
[2020-09-18 18:57:04.153] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Shutdown initiated...
[2020-09-18 18:57:04.179] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] ===> HikariPool-1 - Shutdown completed.
[2020-09-18 19:12:00.790] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Starting HexagonalArchitectureConfigurationApplication on jmendoza-ThinkPad-T420 with PID 1942 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/configuration/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order)
[2020-09-18 19:12:00.804] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> No active profile set, falling back to default profiles: default
[2020-09-18 19:12:01.880] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-09-18 19:12:01.899] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] ===> Finished Spring Data repository scanning in 14ms. Found 0 JDBC repository interfaces.
[2020-09-18 19:12:02.490] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat initialized with port(s): 3002 (http)
[2020-09-18 19:12:02.501] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Initializing ProtocolHandler ["http-nio-3002"]
[2020-09-18 19:12:02.502] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] ===> Starting service [Tomcat]
[2020-09-18 19:12:02.502] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] ===> Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-09-18 19:12:02.601] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] ===> Initializing Spring embedded WebApplicationContext
[2020-09-18 19:12:02.601] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] ===> Root WebApplicationContext: initialization completed in 1564 ms
[2020-09-18 19:12:02.948] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Initializing ExecutorService 'applicationTaskExecutor'
[2020-09-18 19:12:03.469] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] ===> Starting ProtocolHandler ["http-nio-3002"]
[2020-09-18 19:12:03.488] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] ===> Tomcat started on port(s): 3002 (http) with context path ''
[2020-09-18 19:12:03.500] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.configuration.HexagonalArchitectureConfigurationApplication] ===> Started HexagonalArchitectureConfigurationApplication in 3.643 seconds (JVM running for 5.417)
[2020-09-18 19:12:41.175] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] ===> Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-09-18 19:12:41.176] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Initializing Servlet 'dispatcherServlet'
[2020-09-18 19:12:41.192] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] ===> Completed initialization in 16 ms
[2020-09-18 19:12:41.344] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"808a493284b4f071","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/36","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["169d375b-96ac-4c72-0fc0-6b9afe8dfc58"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:12:41.495] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"808a493284b4f071","duration":259,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:12:41 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"36","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:10:12.000+00:00","orderProductList":[{"orderProductId":19,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":20,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:12:56.461] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"b611a2d00884de84","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["d55bc226-c078-a37b-cad2-19222f8bc47b"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-09-18 19:12:56.552] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"b611a2d00884de84","duration":93,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:12:56 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37"}}
[2020-09-18 19:13:03.370] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"88a9e0808f9cc457","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["cefcfe7f-4d3a-b730-02c7-851e5b2ba822"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:13:03.388] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"88a9e0808f9cc457","duration":18,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:13:03 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12.000+00:00","orderProductList":[{"orderProductId":21,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":22,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:13:06.905] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"remote","type":"request","correlation":"820cbaa656edc6c7","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/37","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["ab49a767-8eba-61f4-557a-e999b2b4c07d"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"]}}
[2020-09-18 19:13:06.923] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] ===> {"origin":"local","type":"response","correlation":"820cbaa656edc6c7","duration":19,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 18 Sep 2020 23:13:06 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"37","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-09-18T00:30:12.000+00:00","orderProductList":[{"orderProductId":21,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":22,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-09-18 19:13:11.071] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] ===> Shutting down ExecutorService 'applicationTaskExecutor'
================================================
FILE: Order/pom.xml
================================================
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.3.0.RELEASE
com.jmendoza.swa.hexagonal
order
1.0
pom
hexagonal-architecture-order
Example of Hexagonal Architecture - Orders
1.8
application
common
configuration
domain
infrastructure
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-log4j
org.springframework.boot
spring-boot-starter-log4j2
2.2.6.RELEASE
com.lmax
disruptor
3.3.6
org.projectlombok
lombok
1.18.12
provided
javax.validation
validation-api
2.0.0.Final
org.apache.commons
commons-lang3
3.10
org.modelmapper
modelmapper
2.3.5
com.google.code.gson
gson
2.8.9
org.springframework.boot
spring-boot-starter-test
test
org.junit.vintage
junit-vintage-engine
================================================
FILE: Order/postgresql/1-create_table_orders.sql
================================================
-- Table: public.ORDERS
-- DROP TABLE public."ORDERS";
CREATE TABLE public."ORDERS"
(
order_id bigint NOT NULL,
customer_id character varying COLLATE pg_catalog."default" NOT NULL,
created_at timestamp with time zone NOT NULL,
amount_order double precision NOT NULL,
CONSTRAINT "ORDERS_pkey" PRIMARY KEY (order_id)
)
TABLESPACE pg_default;
ALTER TABLE public."ORDERS"
OWNER to postgres;
GRANT ALL ON TABLE public."ORDERS" TO postgres;
================================================
FILE: Order/postgresql/2-create_sequence_order_id.sql
================================================
-- SEQUENCE: public.order_id_seq
-- DROP SEQUENCE public.order_id_seq;
CREATE SEQUENCE public.order_id_seq
INCREMENT 1
START 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
ALTER SEQUENCE public.order_id_seq
OWNER TO postgres;
GRANT ALL ON SEQUENCE public.order_id_seq TO postgres;
================================================
FILE: Order/postgresql/3-create_function_create_order.sql
================================================
-- FUNCTION: public.create_order(character varying, timestamp with time zone, double precision, text)
-- DROP FUNCTION public.create_order(character varying, timestamp with time zone, double precision, text);
CREATE OR REPLACE FUNCTION public.create_order(
p_customer_id character varying,
p_created_at timestamp with time zone,
p_amount_order double precision,
p_order_product text)
RETURNS bigint
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
DECLARE
p_order_id bigint;
p_order_product_id bigint;
p_json json;
BEGIN
p_order_id := nextval('order_id_seq');
INSERT INTO public."ORDERS"(
order_id, customer_id, created_at, amount_order)
VALUES (p_order_id, p_customer_id, p_created_at, p_amount_order);
FOR p_json IN SELECT * FROM json_array_elements(p_order_product::json)
LOOP
p_order_product_id := nextval('order_product_id_seq');
INSERT INTO public."ORDERS_PRODUCTS"(
order_product_id, quantity, product_id, product_price, order_id)
VALUES (p_order_product_id, CAST (p_json->>'quantity' AS bigint) , p_json->>'productId', CAST(p_json->>'productPrice' AS double precision), p_order_id);
END LOOP;
RETURN p_order_id;
END;
$BODY$;
ALTER FUNCTION public.create_order(character varying, timestamp with time zone, double precision, text)
OWNER TO postgres;
================================================
FILE: Order/postgresql/4-create_table_order_product.sql
================================================
-- Table: public.ORDERS_PRODUCTS
-- DROP TABLE public."ORDERS_PRODUCTS";
CREATE TABLE public."ORDERS_PRODUCTS"
(
order_product_id bigint NOT NULL,
quantity bigint NOT NULL,
product_id character varying COLLATE pg_catalog."default" NOT NULL,
product_price double precision NOT NULL,
order_id bigint NOT NULL,
CONSTRAINT "ORDERS_PRODUCTS_pkey" PRIMARY KEY (order_product_id),
CONSTRAINT order_id_fk FOREIGN KEY (order_id)
REFERENCES public."ORDERS" (order_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)
TABLESPACE pg_default;
ALTER TABLE public."ORDERS_PRODUCTS"
OWNER to postgres;
GRANT ALL ON TABLE public."ORDERS_PRODUCTS" TO postgres;
================================================
FILE: Order/postgresql/5-create_order_product_id_seq.sql
================================================
-- SEQUENCE: public.order_product_id_seq
-- DROP SEQUENCE public.order_product_id_seq;
CREATE SEQUENCE public.order_product_id_seq
INCREMENT 1
START 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
ALTER SEQUENCE public.order_product_id_seq
OWNER TO postgres;
GRANT ALL ON SEQUENCE public.order_product_id_seq TO postgres;
================================================
FILE: Order/postgresql/6-create_function_get_order.sql
================================================
-- FUNCTION: public.get_order(bigint)
-- DROP FUNCTION public.get_order(bigint);
CREATE OR REPLACE FUNCTION public.get_order(
p_order_id bigint)
RETURNS json
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
DECLARE
json_op json;
json_result json;
BEGIN
json_op:= (SELECT
json_agg(
json_build_object(
'orderProductId',OP.order_product_id,
'quantity', OP.quantity,
'productId',OP.product_id,
'productPrice',OP.product_price))
FROM public."ORDERS_PRODUCTS" AS OP
WHERE OP.order_id = p_order_id);
json_result:= (SELECT
json_build_object(
'orderId', O.order_id,
'customerId', O.customer_id,
'createdAt', O.created_at,
'orderProductList',json_op,
'amountOrder', O.amount_order)
FROM public."ORDERS" AS O
WHERE O.order_id = p_order_id);
RETURN json_result;
END;
$BODY$;
ALTER FUNCTION public.get_order(bigint)
OWNER TO postgres;
GRANT EXECUTE ON FUNCTION public.get_order(bigint) TO postgres;
GRANT EXECUTE ON FUNCTION public.get_order(bigint) TO PUBLIC;
================================================
FILE: Product/.gitignore
================================================
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
================================================
FILE: Product/README.md
================================================
# Products Microservice
Example of Products Microservice applying Hexagonal Architecture pattern, Domain Driven Design (DDD) and SOLID principles.
This example was implemented with Spring Boot, MongoDB Atlas. The microservices are deployed locally and the DB in the cloud.
## MongoDB Atlas
- Signup free at https://www.mongodb.com/cloud/atlas/signup
- Create DATABASE and COLLECTION (Optional)
- Create Database User
- Add your IP Address (public) in IP Whitelist, Network Access

## Configure your application.properties

## Create Products
**Postman**


**MongoDB Atlas**

## Get Products
**Postman**

================================================
FILE: Product/pom.xml
================================================
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.3.0.RELEASE
com.jmendoza.swa.hexagonal
product
1.0
product
Example of Hexagonal Architecture - Products
1.8
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-log4j
org.projectlombok
lombok
provided
javax.validation
validation-api
2.0.0.Final
org.springframework.boot
spring-boot-starter-data-mongodb
org.springframework.boot
spring-boot-actuator-autoconfigure
org.apache.commons
commons-lang3
org.modelmapper
modelmapper
2.3.5
org.springframework.boot
spring-boot-starter-log4j2
2.2.6.RELEASE
com.lmax
disruptor
3.3.6
org.zalando
logbook-spring-boot-starter
2.1.0
org.springframework.boot
spring-boot-starter-test
test
org.junit.vintage
junit-vintage-engine
org.springframework.boot
spring-boot-maven-plugin
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/ProductApplication.java
================================================
package com.jmendoza.swa.hexagonal.product;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProductApplication {
public static void main(String[] args) {
SpringApplication.run(ProductApplication.class, args);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/controller/ProductController.java
================================================
package com.jmendoza.swa.hexagonal.product.application.rest.controller;
import com.jmendoza.swa.hexagonal.product.application.rest.response.CreateProductResponse;
import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.CreateProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.DeleteProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductsUseCase;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/v1/products")
@AllArgsConstructor
public class ProductController {
private final CreateProductUseCase createProductUseCase;
private final DeleteProductUseCase deleteProductUseCase;
private final GetProductsUseCase getProductsUseCase;
private final GetProductUseCase getProductUseCase;
@PostMapping
public ResponseEntity createProduct(@Valid @RequestBody Product product) throws GlobalException, ParameterNotFoundException {
createProductUseCase.createProduct(product);
return ResponseEntity.ok().body(CreateProductResponse.builder().id(product.getId()).build());
}
@DeleteMapping("/{id}")
public ResponseEntity deleteCustomer(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
deleteProductUseCase.deleteProduct(id);
return ResponseEntity.noContent().build();
}
@GetMapping
public ResponseEntity> getProducts() throws ResourceNotFoundException {
List productList = getProductsUseCase.getProducts();
return ResponseEntity.ok().body(productList);
}
@GetMapping("/{id}")
public ResponseEntity getProduct(@PathVariable(value = "id") String id) throws ResourceNotFoundException {
Product product = getProductUseCase.getProduct(id);
return ResponseEntity.ok().body(product);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/request/README.md
================================================
*In this directory you can add specialized requests, to only request minimum data, for example CreateProductRequest.*
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/rest/response/CreateProductResponse.java
================================================
package com.jmendoza.swa.hexagonal.product.application.rest.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateProductResponse {
private String id;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/application/soap/README.md
================================================
*In this directory you can add another type of adapter to access the domain, for example a ProductController class to expose SOAP.*
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/config/README.md
================================================
*In this directory you can add settings for the infrastructure layer or the application layer.*
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/constants/ProductConstanst.java
================================================
package com.jmendoza.swa.hexagonal.product.common.constants;
public class ProductConstanst {
public static final String PRODUCT_NOT_FOUND = "Product not found :: ";
public static final String REQUIRED_PARAMETER = "Required parameter ";
public static final String IS_NOT_PRESENT = " is not present";
public static final double D_2 = 0.0;
public static final int INT = 0;
public static final String THIS_PRODUCT_IS_ALREADY_REGISTERED = "This Product is already registered ";
public static final String PRODUCTS_NOT_FOUND = "Products not found";
private ProductConstanst() {
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/customannotations/UseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.common.customannotations;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface UseCase {
@AliasFor(annotation = Component.class)
String value() default "";
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/CustomExceptionHandler.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import java.util.Date;
@ControllerAdvice
public class CustomExceptionHandler {
private static final Logger loggerException = LogManager.getLogger(CustomExceptionHandler.class);
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity resourceNotFoundException(ResourceNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
}
@ExceptionHandler({GlobalException.class})
public ResponseEntity globalExceptionHandler(GlobalException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
}
@ExceptionHandler({ParameterNotFoundException.class})
public ResponseEntity parameterNotFoundExceptionHandler(ParameterNotFoundException ex, WebRequest request) {
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
loggerException.error(ex);
return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ErrorDetails.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Date;
@Getter
@AllArgsConstructor
public class ErrorDetails {
private Date timestamp;
private String message;
private String details;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/GlobalException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public class GlobalException extends Exception {
private static final long serialVersionUID = 1L;
public GlobalException(String message) {
super(message);
}
public GlobalException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ParameterNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class ParameterNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ParameterNotFoundException(String message) {
super(message);
}
public ParameterNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/common/exception/ResourceNotFoundException.java
================================================
package com.jmendoza.swa.hexagonal.product.common.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ResourceNotFoundException(String message) {
super(message);
}
public ResourceNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/model/Product.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class Product {
private String id;
private String productName;
private String productDescription;
private Double price;
private String createdAt;
private String serialNumber;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/CreateProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
public interface CreateProductUseCase {
void createProduct(Product product) throws ParameterNotFoundException, GlobalException;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/DeleteProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
public interface DeleteProductUseCase {
void deleteProduct(String id) throws ResourceNotFoundException;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
public interface GetProductUseCase {
Product getProduct(String id) throws ResourceNotFoundException;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/inbound/GetProductsUseCase.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.inbound;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import java.util.List;
public interface GetProductsUseCase {
List getProducts() throws ResourceNotFoundException;
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/CreateProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
public interface CreateProductPort {
void createProduct(Product product);
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/DeleteProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
public interface DeleteProductPort {
void deleteProduct(Product product);
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/ExistsProductPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;
public interface ExistsProductPort {
boolean existsBySerialNumber(String serialNumber);
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductIdPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import java.util.Optional;
public interface GetProductIdPort {
Optional getProductById(String id);
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/ports/outbound/GetProductsPort.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.ports.outbound;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import java.util.List;
public interface GetProductsPort {
List getProducts();
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/CreateProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;
import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.GlobalException;
import com.jmendoza.swa.hexagonal.product.common.exception.ParameterNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.CreateProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.CreateProductPort;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.ExistsProductPort;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@AllArgsConstructor
@UseCase
public class CreateProductService implements CreateProductUseCase {
private CreateProductPort createProductPort;
private ExistsProductPort existsProductPort;
@Override
public void createProduct(Product product) throws ParameterNotFoundException, GlobalException {
if (StringUtils.isBlank(product.getProductName()))
getMessageParameterNotFoundException("productName");
if (StringUtils.isBlank(product.getProductDescription()))
getMessageParameterNotFoundException("productDescription");
if (product.getPrice() == null || Double.compare(product.getPrice(), ProductConstanst.D_2) <= ProductConstanst.INT)
getMessageParameterNotFoundException("price");
if (StringUtils.isBlank(product.getCreatedAt()))
getMessageParameterNotFoundException("createdAt");
if (StringUtils.isBlank(product.getSerialNumber()))
getMessageParameterNotFoundException("serialNumber");
if (existsProductPort.existsBySerialNumber(product.getSerialNumber()))
throw new GlobalException(ProductConstanst.THIS_PRODUCT_IS_ALREADY_REGISTERED);
createProductPort.createProduct(product);
}
private void getMessageParameterNotFoundException(String parameter) throws ParameterNotFoundException {
throw new ParameterNotFoundException(ProductConstanst.REQUIRED_PARAMETER + "\"" + parameter + "\"" + ProductConstanst.IS_NOT_PRESENT);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/DeleteProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;
import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.DeleteProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.DeleteProductPort;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@UseCase
public class DeleteProductService implements DeleteProductUseCase {
private GetProductIdPort getProductIdPort;
private DeleteProductPort deleteProductPort;
@Override
public void deleteProduct(String id) throws ResourceNotFoundException {
Product product = getProductIdPort.getProductById(id)
.orElseThrow(() -> new ResourceNotFoundException(ProductConstanst.PRODUCT_NOT_FOUND + id));
deleteProductPort.deleteProduct(product);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;
import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@UseCase
public class GetProductService implements GetProductUseCase {
private GetProductIdPort getProductIdPort;
@Override
public Product getProduct(String id) throws ResourceNotFoundException {
return getProductIdPort.getProductById(id)
.orElseThrow(() -> new ResourceNotFoundException(ProductConstanst.PRODUCT_NOT_FOUND + id));
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/domain/services/GetProductsService.java
================================================
package com.jmendoza.swa.hexagonal.product.domain.services;
import com.jmendoza.swa.hexagonal.product.common.constants.ProductConstanst;
import com.jmendoza.swa.hexagonal.product.common.customannotations.UseCase;
import com.jmendoza.swa.hexagonal.product.common.exception.ResourceNotFoundException;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.inbound.GetProductsUseCase;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductsPort;
import lombok.AllArgsConstructor;
import java.util.List;
@AllArgsConstructor
@UseCase
public class GetProductsService implements GetProductsUseCase {
private GetProductsPort getProductsPort;
@Override
public List getProducts() throws ResourceNotFoundException {
List productList = getProductsPort.getProducts();
if (productList.isEmpty())
throw new ResourceNotFoundException(ProductConstanst.PRODUCTS_NOT_FOUND);
return productList;
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/CreateProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.CreateProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CreateProductAdapter implements CreateProductPort {
@Autowired
private ProductRepository productRepository;
@Override
public void createProduct(Product product) {
productRepository.save(product);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/DeleteProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.DeleteProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DeleteProductAdapter implements DeleteProductPort {
@Autowired
private ProductRepository productRepository;
@Override
public void deleteProduct(Product product) {
productRepository.delete(product);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ExistsProductAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.ExistsProductPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ExistsProductAdapter implements ExistsProductPort {
@Autowired
private ProductRepository productRepository;
@Override
public boolean existsBySerialNumber(String serialNumber) {
return productRepository.existsBySerialNumber(serialNumber);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductIdAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductIdPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
@Component
public class GetProductIdAdapter implements GetProductIdPort {
@Autowired
private ProductRepository productRepository;
@Override
public Optional getProductById(String id) {
return productRepository.findById(id);
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/GetProductsAdapter.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import com.jmendoza.swa.hexagonal.product.domain.ports.outbound.GetProductsPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class GetProductsAdapter implements GetProductsPort {
@Autowired
private ProductRepository productRepository;
@Override
public List getProducts() {
return productRepository.findAll();
}
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/mongo/ProductRepository.java
================================================
package com.jmendoza.swa.hexagonal.product.infrastructure.databases.mongo;
import com.jmendoza.swa.hexagonal.product.domain.model.Product;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ProductRepository extends MongoRepository {
boolean existsBySerialNumber(String serialNumber);
}
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/databases/postgresql/README.md
================================================
*In this directory you can add another type of DB adapter for example PostgreSQL.*
================================================
FILE: Product/src/main/java/com/jmendoza/swa/hexagonal/product/infrastructure/messagebroker/README.md
================================================
*In this directory you can add another type of adapter to send messages in a message broker, for example Kafka, RabbitMQ.*
================================================
FILE: Product/src/main/resources/application.properties
================================================
# Application Server
server.port=3001
# MongoDB Atlas
spring.data.mongodb.uri=mongodb+srv://jmendoza:zuZYkSpMIpSGqgLD@cluster0-7rxkw.mongodb.net/product?retryWrites=true&w=majority&maxIdleTimeMS=600000&connectTimeoutMS=60000
# Logbook: HTTP request and response logging
logging.level.org.zalando.logbook = TRACE
================================================
FILE: Product/src/main/resources/log4j2.xml
================================================
[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%p] [${hostName}] [%t] [%c{3}] ==> %m%n
${LOG_PATTERN}
================================================
FILE: Product/src/test/java/com/jmendoza/swa/hexagonal/product/ProductApplicationTests.java
================================================
package com.jmendoza.swa.hexagonal.product;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ProductApplicationTests {
@Test
void contextLoads() {
}
}
================================================
FILE: README.md
================================================
# Hexagonal-Architecture-DDD
Ports and Adapters or also known as Hexagonal Architecture, is a popular architecture invented by Alistair Cockburn in 2005.
Example of how to use Hexagonal Architecture and the basic of Domain Driven Design (DDD)
This example is made with Spring Boot, MongoDB, PostgreSQL
## Domain Driven Design (DDD)
Domain-Driven Design is an approach to software development that centers the development on programming a domain model that has a rich understanding of the processes and rules of a domain.
Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships.

*Reference:*
- https://martinfowler.com/tags/domain%20driven%20design.html
## Hexagonal Architecture
The hexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level and facilitates test automation.
The business logic interacts with other components through ports and adapters. This way, we can change the underlying technologies without having to modify the application core.
**The hexagonal architecture is based on three principles and techniques:**
1. Explicitly separate Application, Domain, and Infrastructure
2. Dependencies are going from Application and Infrastructure to the Domain
3. We isolate the boundaries by using Ports and Adapters
Note: The words Application, Domain and Infrastructure do not come from the original article but from the frequent use of hexagonal architecture by Domain-Driven Design practitioners.

**Note: A port in Java is an interface. An adapter is one implementation of that interface.**
### Domain Layer, in the center
- The domain layer represents the inside of the application and provides ports to interact with application use cases (business logic).
- This is the part that we want to isolate from both left and right sides. It contains all the code that concerns and implements business logic (use cases).
- Because domain objects have no dependencies on other layers of the application, changes in other layers don’t affect them.
### Application Layer, on the left
- The application layer provides different adapters for outside entities to interact with the domain through the port.
- This is the side through which the user or external programs will interact with the application. It contains the code that allows these interactions. Typically, your user interface code, your HTTP routes for an API, your JSON serializations to programs that consume your application are here.
### Infrastructure Layer, on the right
- Provide adapters and server-side logic to interact with the application from the right side. Server-side entities, such as a database or other run-time devices, use these adapters to interact with the domain.
- It contains essential infrastructure details such as the code that interacts with your database, makes calls to the file system, or code that handles HTTP calls to other applications on which you depend for example.
*Reference:*
- https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)
- https://dzone.com/articles/hexagonal-architecture-in-java-2
- https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/#principles
## Microservices Architecture

In our example we will use the basic architecture above without API Gateway. Customer, Product, Order do not necessarily have to be in different databases, it depends on the bounded context. The main objective is to highlight the use of Hexagonal Architecture in the microservices code.
All microservices are implemented with Spring Boot, however microservices can be implemented with different technologies.
================================================
FILE: logs/Customer.log
================================================
[2020-06-05 19:35:13.967] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Starting CustomerApplication on jmendoza-ThinkPad-T420 with PID 21851 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Customer/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-05 19:35:13.985] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-05 19:35:13.987] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | No active profile set, falling back to default profiles: default
[2020-06-05 19:35:16.606] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
[2020-06-05 19:35:16.751] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 138ms. Found 1 MongoDB repository interfaces.
[2020-06-05 19:35:19.121] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3000 (http)
[2020-06-05 19:35:19.135] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3000"]
[2020-06-05 19:35:19.135] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-05 19:35:19.136] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-05 19:35:19.312] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-05 19:35:19.312] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 5088 ms
[2020-06-05 19:35:20.056] [INFO] [jmendoza-ThinkPad-T420] [main] [mongodb.driver.cluster] | Cluster created with settings {hosts=[127.0.0.1:27017], srvHost=cluster0-7rxkw.mongodb.net, mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', requiredReplicaSetName='Cluster0-shard-0'}
[2020-06-05 19:35:20.156] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-00-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:20.207] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-01-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:20.209] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-02-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:35:21.354] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:35:21.686] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:3, serverValue:117268}] to cluster0-shard-00-02-7rxkw.mongodb.net:27017
[2020-06-05 19:35:21.732] [INFO] [jmendoza-ThinkPad-T420] [main] [endpoint.web.EndpointLinksResolver] | Exposing 2 endpoint(s) beneath base path '/actuator'
[2020-06-05 19:35:21.770] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3000"]
[2020-06-05 19:35:21.810] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3000 (http) with context path ''
[2020-06-05 19:35:21.827] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.customer.CustomerApplication] | Started CustomerApplication in 8.835 seconds (JVM running for 12.734)
[2020-06-05 19:35:21.881] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-02-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=192045575, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-02-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:02 VET 2020, lastUpdateTimeNanos=16852466771751}
[2020-06-05 19:35:22.285] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-05 19:35:22.286] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-05 19:35:22.294] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(5)-127.0.0.1] [web.servlet.DispatcherServlet] | Completed initialization in 8 ms
[2020-06-05 19:35:22.386] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(4)-127.0.0.1] [mongodb.driver.cluster] | No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=cluster0-shard-00-00-7rxkw.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=cluster0-shard-00-01-7rxkw.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=cluster0-shard-00-02-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=192045575, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-02-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:02 VET 2020, lastUpdateTimeNanos=16852466771751}]}. Waiting for 30000 ms before timing out
[2020-06-05 19:35:22.552] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:2, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.699] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:1, serverValue:112761}] to cluster0-shard-00-00-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.735] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-01-7rxkw.mongodb.net:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=182361086, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-01-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=7fffffff0000000000000027, setVersion=4, lastWriteDate=Fri Jun 05 19:35:03 VET 2020, lastUpdateTimeNanos=16853322260844}
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max election id to 7fffffff0000000000000027 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max set version to 4 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.736] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Discovered replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:22.881] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad6b8dfc52759bdfbc2af', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-00-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=181270372, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-00-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:35:04 VET 2020, lastUpdateTimeNanos=16853467593939}
[2020-06-05 19:35:24.120] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(4)-127.0.0.1] [mongodb.driver.connection] | Opened connection [connectionId{localValue:4, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:35:42.449] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3000-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ed06e08d93d52b31","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3000/v1/customers/login","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["65"],"content-type":["application/json"],"host":["localhost:3000"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["6b0758a1-1971-c17a-0e71-452421211679"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]},"body":{"email":"jmendoza@gmail.com","password":"123456789"}}
[2020-06-05 19:35:43.389] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3000-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ed06e08d93d52b31","duration":1012,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 23:35:43 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"id":"5ed047dda2923f1ac2c64463","firstName":"Jonathan","lastName":"Mendoza","email":"jmendoza@gmail.com","createdAt":"2020-05-28T19:15:07"}}
[2020-06-05 19:35:53.372] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:35:53.566] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [mongodb.driver.connection] | Closed connection [connectionId{localValue:4, serverValue:137759}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017 because the pool has been closed.
================================================
FILE: logs/Order.log
================================================
[2020-06-04 20:02:21.856] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 409 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:02:21.864] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:02:21.865] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:02:23.473] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:02:23.512] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 32ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:02:24.391] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:02:24.416] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:02:24.418] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:02:24.419] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:02:24.520] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:02:24.520] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2463 ms
[2020-06-04 20:02:25.181] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:02:25.470] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:02:25.718] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:02:25.869] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:02:25.954] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:02:25.986] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 4.937 seconds (JVM running for 8.358)
[2020-06-04 20:02:40.615] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:02:40.615] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:02:40.623] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 8 ms
[2020-06-04 20:02:40.978] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"b794ba38ddd228dc","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["5af5b78f-62a6-d224-fb1a-13c7c657372d"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:02:41.087] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.GlobalException: Exception getOrder: A CallableStatement function was executed and the out parameter 1 was of type java.sql.Types=1111 however type java.sql.Types=12 was registered.
[2020-06-04 20:02:41.132] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"b794ba38ddd228dc","duration":363,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:02:41 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:02:41.087+00:00","message":"Exception getOrder: A CallableStatement function was executed and the out parameter 1 was of type java.sql.Types=1111 however type java.sql.Types=12 was registered.","details":"uri=/v1/orders/32"}}
[2020-06-04 20:02:50.032] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:02:50.033] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:02:50.047] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 20:04:10.045] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 819 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:04:10.060] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:04:10.062] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:04:11.159] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:04:11.182] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 19ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:04:11.701] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:04:11.710] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:04:11.711] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:04:11.711] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:04:11.775] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:04:11.775] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1451 ms
[2020-06-04 20:04:12.152] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:04:12.351] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:04:12.591] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:04:12.690] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:04:12.710] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:04:12.724] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 3.421 seconds (JVM running for 4.688)
[2020-06-04 20:04:17.992] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:04:17.993] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:04:17.999] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 6 ms
[2020-06-04 20:04:18.095] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ac45c9810ba66cf8","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["4f02cf7c-d700-bf82-d111-92dc8e5fa7eb"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:04:18.153] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.GlobalException: Exception getOrder: Parameter of type java.sql.Types=1111 was registered, but call to getString (sqltype=java.sql.Types=12) was made.
[2020-06-04 20:04:18.542] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ac45c9810ba66cf8","duration":171,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:04:18 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:04:18.152+00:00","message":"Exception getOrder: Parameter of type java.sql.Types=1111 was registered, but call to getString (sqltype=java.sql.Types=12) was made.","details":"uri=/v1/orders/32"}}
[2020-06-04 20:04:55.651] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:04:55.652] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:04:55.663] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 20:05:03.044] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 1159 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:05:03.065] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:05:03.067] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:05:04.090] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:05:04.109] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 15ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:05:04.609] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:05:04.617] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:05:04.617] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:05:04.618] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:05:04.682] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:05:04.683] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1316 ms
[2020-06-04 20:05:05.074] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:05:05.276] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:05:05.492] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:05:05.598] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:05:05.620] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:05:05.636] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 3.398 seconds (JVM running for 4.858)
[2020-06-04 20:05:08.534] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:05:08.534] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:05:08.540] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 6 ms
[2020-06-04 20:05:08.652] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"85d360aaac8267a6","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["0a643db2-2092-9c1d-f686-65f537f617cc"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:05:08.711] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.GlobalException: Exception getOrder: org.postgresql.util.PGobject cannot be cast to java.lang.String
[2020-06-04 20:05:08.782] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"85d360aaac8267a6","duration":213,"protocol":"HTTP/1.1","status":500,"headers":{"Connection":["close"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:05:08 GMT"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:05:08.711+00:00","message":"Exception getOrder: org.postgresql.util.PGobject cannot be cast to java.lang.String","details":"uri=/v1/orders/32"}}
[2020-06-04 20:08:41.141] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:08:41.142] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:08:41.158] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 20:11:08.629] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 1850 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:11:08.658] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:11:08.660] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:11:10.394] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:11:10.423] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 24ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:11:10.931] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:11:10.943] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:11:10.944] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:11:10.944] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:11:11.062] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:11:11.062] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1896 ms
[2020-06-04 20:11:11.485] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:11:11.707] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:11:11.898] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:11:12.008] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:11:12.032] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:11:12.048] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 4.446 seconds (JVM running for 6.484)
[2020-06-04 20:11:25.194] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:11:25.195] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:11:25.201] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 6 ms
[2020-06-04 20:11:25.317] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"b6d74fdd6d7648bd","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["1c66c399-d19f-bda7-3f81-d5f71c7f5424"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:11:25.458] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"b6d74fdd6d7648bd","duration":231,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:11:25 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"32","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":11,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":12,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 20:11:44.501] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"fb6706bd1c788601","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["65858cae-6e02-6a24-9bdc-57cf53c2c827"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:11:44.518] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"fb6706bd1c788601","duration":14,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:11:44 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"32","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":11,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":12,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 20:11:49.030] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"fb872655e36edfee","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/31","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["faf6afdd-41e5-2178-282d-b9a29bc4add2"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:11:49.037] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.ResourceNotFoundException: Order not found ::
[2020-06-04 20:11:49.043] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"fb872655e36edfee","duration":13,"protocol":"HTTP/1.1","status":404,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:11:49 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:11:49.037+00:00","message":"Order not found :: ","details":"uri=/v1/orders/31"}}
[2020-06-04 20:11:58.288] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:11:58.289] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:11:58.309] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 20:13:24.942] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 2292 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 20:13:24.967] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 20:13:24.969] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 20:13:26.050] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 20:13:26.075] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 20ms. Found 0 JDBC repository interfaces.
[2020-06-04 20:13:26.617] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 20:13:26.625] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:13:26.626] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 20:13:26.626] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 20:13:26.726] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 20:13:26.726] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1457 ms
[2020-06-04 20:13:27.101] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:13:27.299] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 20:13:27.501] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 20:13:27.605] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 20:13:27.629] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 20:13:27.645] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 3.365 seconds (JVM running for 4.721)
[2020-06-04 20:13:35.581] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 20:13:35.582] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 20:13:35.587] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 5 ms
[2020-06-04 20:13:35.678] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"f4818004a78278e0","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/31","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["064e6ae9-779f-f8fc-3974-9e43c6d71b65"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:13:35.743] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.ResourceNotFoundException: Order not found :: 31
[2020-06-04 20:13:35.810] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"f4818004a78278e0","duration":198,"protocol":"HTTP/1.1","status":404,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:13:35 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:13:35.743+00:00","message":"Order not found :: 31","details":"uri=/v1/orders/31"}}
[2020-06-04 20:13:37.932] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"c6303a24a1c99990","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/31","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["6b796afa-0cf0-2a39-f4f5-2ccc54aee7e6"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:13:37.935] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.ResourceNotFoundException: Order not found :: 31
[2020-06-04 20:13:37.938] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"c6303a24a1c99990","duration":6,"protocol":"HTTP/1.1","status":404,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:13:37 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T00:13:37.935+00:00","message":"Order not found :: 31","details":"uri=/v1/orders/31"}}
[2020-06-04 20:13:41.838] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"fcc29c548360e70e","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["e6c8b468-0fe1-242a-c460-dbcb2cd865d3"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 20:13:41.876] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"fcc29c548360e70e","duration":37,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 00:13:41 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"32","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":11,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":12,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 20:30:53.889] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 20:30:53.891] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 20:30:53.907] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
[2020-06-04 21:50:39.915] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Starting OrderApplication on jmendoza-ThinkPad-T420 with PID 5896 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Order/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-04 21:50:39.930] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-04 21:50:39.933] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | No active profile set, falling back to default profiles: default
[2020-06-04 21:50:41.156] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
[2020-06-04 21:50:41.176] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 16ms. Found 0 JDBC repository interfaces.
[2020-06-04 21:50:41.699] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3002 (http)
[2020-06-04 21:50:41.707] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3002"]
[2020-06-04 21:50:41.708] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-04 21:50:41.708] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-04 21:50:41.776] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-04 21:50:41.776] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 1476 ms
[2020-06-04 21:50:42.157] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-04 21:50:42.373] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Starting...
[2020-06-04 21:50:42.600] [INFO] [jmendoza-ThinkPad-T420] [main] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Start completed.
[2020-06-04 21:50:42.728] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3002"]
[2020-06-04 21:50:42.749] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3002 (http) with context path ''
[2020-06-04 21:50:42.764] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.order.OrderApplication] | Started OrderApplication in 3.499 seconds (JVM running for 4.985)
[2020-06-04 21:51:06.364] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-04 21:51:06.364] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-04 21:51:06.371] [INFO] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [web.servlet.DispatcherServlet] | Completed initialization in 6 ms
[2020-06-04 21:51:06.479] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"fb387fb517754f48","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/32","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["615c4f24-a656-5eba-fe95-2a4a1176aaf6"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:51:06.532] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.ResourceNotFoundException: Order not found :: 32
[2020-06-04 21:51:06.582] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"fb387fb517754f48","duration":183,"protocol":"HTTP/1.1","status":404,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:51:06 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T01:51:06.532+00:00","message":"Order not found :: 32","details":"uri=/v1/orders/32"}}
[2020-06-04 21:51:11.286] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"fc6edd7555539c30","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"POST","uri":"http://localhost:3002/v1/orders","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"content-length":["304"],"content-type":["application/json"],"host":["localhost:3002"],"origin":["chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop"],"postman-token":["aa4102b7-1236-18b3-f6fc-2c0a36137803"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]},"body":{"customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12","orderProductList":[{"quantity":"2","productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"quantity":"1","productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}]}}
[2020-06-04 21:51:11.681] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-2] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"fc6edd7555539c30","duration":397,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:51:11 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33"}}
[2020-06-04 21:51:20.571] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"dbd6a343cb852579","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/33","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["fa67b397-4200-3742-8b49-675adf447072"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:51:20.598] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-3] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"dbd6a343cb852579","duration":26,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:51:20 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":13,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":14,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 21:51:25.473] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"ab6b8bdac38d4d01","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/34","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["c3e44873-607b-80dd-7221-cb471cfcd3a0"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:51:25.483] [ERROR] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [common.exception.CustomExceptionHandler] | com.jmendoza.swa.hexagonal.order.common.exception.ResourceNotFoundException: Order not found :: 34
[2020-06-04 21:51:25.489] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-4] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"ab6b8bdac38d4d01","duration":14,"protocol":"HTTP/1.1","status":404,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:51:25 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"timestamp":"2020-06-05T01:51:25.483+00:00","message":"Order not found :: 34","details":"uri=/v1/orders/34"}}
[2020-06-04 21:51:29.465] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-6] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"938864d039b7d3f8","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/33","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["0a335d2b-cd92-c1e7-c904-1f349b7b8fa5"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:51:29.477] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-6] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"938864d039b7d3f8","duration":11,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:51:29 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":13,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":14,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 21:52:50.882] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"91d731033f99fbed","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3002/v1/orders/33","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3002"],"postman-token":["8fe08c78-dcb0-9f1e-a0a8-62f731d232a4"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-04 21:52:50.893] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3002-exec-7] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"91d731033f99fbed","duration":11,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 01:52:50 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":{"orderId":"33","customerId":"5ed047dda2923f1ac2c64463","createdAt":"2020-06-03T22:34:12.000+00:00","orderProductList":[{"orderProductId":13,"quantity":2,"productId":"5ed31ddb669529409edc2fd0","productPrice":1099.51},{"orderProductId":14,"quantity":1,"productId":"5ed31cb5669529409edc2fcf","productPrice":2199.99}],"amountOrder":4399.01}}
[2020-06-04 21:55:51.368] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-04 21:55:51.373] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown initiated...
[2020-06-04 21:55:51.393] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [zaxxer.hikari.HikariDataSource] | HikariPool-1 - Shutdown completed.
================================================
FILE: logs/Product.log
================================================
[2020-06-05 19:40:06.294] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.product.ProductApplication] | Starting ProductApplication on jmendoza-ThinkPad-T420 with PID 22911 (/home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD/Product/target/classes started by jmendoza in /home/jmendoza/IdeaProjects/JonathanM2ndoza/Hexagonal-Architecture-DDD)
[2020-06-05 19:40:06.310] [DEBUG] [jmendoza-ThinkPad-T420] [main] [hexagonal.product.ProductApplication] | Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
[2020-06-05 19:40:06.311] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.product.ProductApplication] | No active profile set, falling back to default profiles: default
[2020-06-05 19:40:08.568] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
[2020-06-05 19:40:08.670] [INFO] [jmendoza-ThinkPad-T420] [main] [repository.config.RepositoryConfigurationDelegate] | Finished Spring Data repository scanning in 96ms. Found 1 MongoDB repository interfaces.
[2020-06-05 19:40:09.163] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat initialized with port(s): 3001 (http)
[2020-06-05 19:40:09.171] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Initializing ProtocolHandler ["http-nio-3001"]
[2020-06-05 19:40:09.171] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardService] | Starting service [Tomcat]
[2020-06-05 19:40:09.171] [INFO] [jmendoza-ThinkPad-T420] [main] [catalina.core.StandardEngine] | Starting Servlet engine: [Apache Tomcat/9.0.35]
[2020-06-05 19:40:09.254] [INFO] [jmendoza-ThinkPad-T420] [main] [[Tomcat].[localhost].[/]] | Initializing Spring embedded WebApplicationContext
[2020-06-05 19:40:09.255] [INFO] [jmendoza-ThinkPad-T420] [main] [web.context.ContextLoader] | Root WebApplicationContext: initialization completed in 2567 ms
[2020-06-05 19:40:09.736] [INFO] [jmendoza-ThinkPad-T420] [main] [mongodb.driver.cluster] | Cluster created with settings {hosts=[127.0.0.1:27017], srvHost=cluster0-7rxkw.mongodb.net, mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', requiredReplicaSetName='Cluster0-shard-0'}
[2020-06-05 19:40:09.837] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-00-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:40:10.030] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-01-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:40:10.035] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-srv-cluster0-7rxkw.mongodb.net] [mongodb.driver.cluster] | Adding discovered server cluster0-shard-00-02-7rxkw.mongodb.net:27017 to client view of cluster
[2020-06-05 19:40:10.579] [INFO] [jmendoza-ThinkPad-T420] [main] [scheduling.concurrent.ThreadPoolTaskExecutor] | Initializing ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:40:10.966] [INFO] [jmendoza-ThinkPad-T420] [main] [endpoint.web.EndpointLinksResolver] | Exposing 2 endpoint(s) beneath base path '/actuator'
[2020-06-05 19:40:11.009] [INFO] [jmendoza-ThinkPad-T420] [main] [coyote.http11.Http11NioProtocol] | Starting ProtocolHandler ["http-nio-3001"]
[2020-06-05 19:40:11.030] [INFO] [jmendoza-ThinkPad-T420] [main] [embedded.tomcat.TomcatWebServer] | Tomcat started on port(s): 3001 (http) with context path ''
[2020-06-05 19:40:11.054] [INFO] [jmendoza-ThinkPad-T420] [main] [hexagonal.product.ProductApplication] | Started ProductApplication in 5.781 seconds (JVM running for 7.746)
[2020-06-05 19:40:11.065] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:2, serverValue:137760}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.210] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-01-7rxkw.mongodb.net:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=139818719, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-01-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=7fffffff0000000000000027, setVersion=4, lastWriteDate=Fri Jun 05 19:39:52 VET 2020, lastUpdateTimeNanos=17141793745012}
[2020-06-05 19:40:11.213] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max election id to 7fffffff0000000000000027 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.213] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Setting max set version to 4 from replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.214] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-01-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Discovered replica set primary cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.330] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:1, serverValue:98416}] to cluster0-shard-00-00-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.335] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.connection] | Opened connection [connectionId{localValue:3, serverValue:117268}] to cluster0-shard-00-02-7rxkw.mongodb.net:27017
[2020-06-05 19:40:11.479] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(3)-127.0.0.1] [[Tomcat].[localhost].[/]] | Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-06-05 19:40:11.480] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(3)-127.0.0.1] [web.servlet.DispatcherServlet] | Initializing Servlet 'dispatcherServlet'
[2020-06-05 19:40:11.487] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(3)-127.0.0.1] [web.servlet.DispatcherServlet] | Completed initialization in 7 ms
[2020-06-05 19:40:11.575] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-00-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-00-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=244808340, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-00-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:39:52 VET 2020, lastUpdateTimeNanos=17142162143540}
[2020-06-05 19:40:11.581] [INFO] [jmendoza-ThinkPad-T420] [cluster-ClusterId{value='5edad7d9117cf45695f7866b', description='null'}-cluster0-shard-00-02-7rxkw.mongodb.net:27017] [mongodb.driver.cluster] | Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-02-7rxkw.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=245578472, setName='Cluster0-shard-0', canonicalAddress=cluster0-shard-00-02-7rxkw.mongodb.net:27017, hosts=[cluster0-shard-00-02-7rxkw.mongodb.net:27017, cluster0-shard-00-01-7rxkw.mongodb.net:27017, cluster0-shard-00-00-7rxkw.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01-7rxkw.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, electionId=null, setVersion=4, lastWriteDate=Fri Jun 05 19:39:52 VET 2020, lastUpdateTimeNanos=17142167993915}
[2020-06-05 19:40:14.595] [INFO] [jmendoza-ThinkPad-T420] [RMI TCP Connection(2)-127.0.0.1] [mongodb.driver.connection] | Opened connection [connectionId{localValue:4, serverValue:137760}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017
[2020-06-05 19:40:40.644] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3001-exec-1] [zalando.logbook.Logbook] | {"origin":"remote","type":"request","correlation":"eb39353f3075a2a6","protocol":"HTTP/1.1","remote":"0:0:0:0:0:0:0:1","method":"GET","uri":"http://localhost:3001/v1/products","headers":{"accept":["*/*"],"accept-encoding":["gzip, deflate, br"],"accept-language":["es-419,es-US;q=0.9,es;q=0.8,en-US;q=0.7,en;q=0.6"],"cache-control":["no-cache"],"connection":["keep-alive"],"host":["localhost:3001"],"postman-token":["eb5c9aba-dd9d-e6b6-46f2-1bbb338e8424"],"sec-fetch-dest":["empty"],"sec-fetch-mode":["cors"],"sec-fetch-site":["none"],"user-agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"]}}
[2020-06-05 19:40:40.982] [TRACE] [jmendoza-ThinkPad-T420] [http-nio-3001-exec-1] [zalando.logbook.Logbook] | {"origin":"local","type":"response","correlation":"eb39353f3075a2a6","duration":383,"protocol":"HTTP/1.1","status":200,"headers":{"Connection":["keep-alive"],"Content-Type":["application/json"],"Date":["Fri, 05 Jun 2020 23:40:40 GMT"],"Keep-Alive":["timeout=60"],"Transfer-Encoding":["chunked"]},"body":[{"id":"5ed31cb5669529409edc2fcf","productName":"Apple MacBook Pro","productDescription":"New Apple MacBook Pro (16-Inch, 16GB RAM, 512GB Storage) - Space Gray","price":2199.99,"createdAt":"2020-05-30T22:55:15","serialNumber":"4548FFSDFDF5665"},{"id":"5ed31ddb669529409edc2fd0","productName":"Apple iPhone 11 Pro","productDescription":"Apple iPhone 11 Pro (64GB, Midnight Green)","price":1099.99,"createdAt":"2020-05-30T23:01:07","serialNumber":"SDFGHGH3456768FG"}]}
[2020-06-05 19:40:46.294] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [scheduling.concurrent.ThreadPoolTaskExecutor] | Shutting down ExecutorService 'applicationTaskExecutor'
[2020-06-05 19:40:46.497] [INFO] [jmendoza-ThinkPad-T420] [SpringContextShutdownHook] [mongodb.driver.connection] | Closed connection [connectionId{localValue:4, serverValue:137760}] to cluster0-shard-00-01-7rxkw.mongodb.net:27017 because the pool has been closed.
================================================
FILE: prtsc/Hexagonal-Architecture-Microservices.drawio
================================================
7VtZd9o4FP41OWf6YI53zCOBpMsk07SZpZ2XHmELo9a2PLJIIb9+riwJvBHIlKWZQx4AXV2t33cXyc6FM0oXrxnKZ7c0wsmFbUaLC2d8YduBacGnECylwB24UhAzEkmRtRbck0eshKaSzkmEi5oipzThJK8LQ5plOOQ1GWKMfq+rTWlSHzVHMW4J7kOUtKV/kYjPlNTyB+uKN5jEMzV0YPdlRYq0slpJMUMR/V4ROVcXzohRyuWvdDHCidg7vS+y3fWG2tXEGM74Lg3675IPSfbbzdTO/Dn//HHy6TE3AjU3vtQLxhGsXxUp4zMa0wwlV2vpJaPzLMKiVxNKa50bSnMQWiD8ijlfKjDRnFMQzXiaqFo5phho41KUqKBzFiqt4k/LNcIvv3+d82BKDJzn90zOX633NaYp5mwJ7RhOECcP9f6RokK80ls1vaMERrZNxVrPUZgp0tqmV++CIxZjrlqt93zIGFpW1HKhUGwexzUHtXFc069DuEVfz0vpww85A12q7MlaVNLiGRQZnCmyA0U0dPumiON1j7OJIlv0D0MR7ax/To4cHHtfr38L9q2O7H7L/nuN2Uh6n9zT6CXui0abLdU2H1AyV9C0aPWAGScQnW/QBCd3tCCc0AyqJpRzmgIpUJHLNGBKFoJcVcLoxsOExKIRF0S7LDij3/CIJpSBLKOZICdSKiFQCTPBzzlPSAZqOs0QpIWQnouJpYtYJD+9kHBGFj1IWL7Jvjd6LTEVvHiSpLp2UCeb4/k9V4Wj7+uMRGvNKrnIYNBkU5XbFSyfD9WgAyo/4WK/LZGNJaiQQ/r/zEWCcwn7QUJOOAC5kq0H0ZKCpHmCjZSEjBaYPZAQFwZi4Yxw2PU5wwbNDAQ5XbWPNT20MAX7IwDfEGodhlP4MvMFfFqyINtNacaNKUpJspSq0AFKJWyO4woWpOgR6AVOJp0AC5rVZZNRV8MZTh6w4BpUZniOn9GUUeAyfUYDxAhKNusXKCsM2EsyXS08lFwXS2bx5JcSSalse6ufjvVq1SBHUUSyWDaROykrhEkYmnKi0uqBr6js8QSF3+LS0xvNUT2vMmzt96sqvH6svkt2Ccw6IS/BLMpQUc4jELNs9nJf0guqb6sEg/KwQjE9FNiFHK0+AxALimthwz+BUfO602EYZoUmpYLYFBHH5DzL6pajaTqplERRGS+Vi4dhvMsLbyzWTJKk4bc6nVk90opFqZhqefvxUf1mutxyT47V4Z+sZtzcm3ty+6dISGAD2fITFAyzZ7qelnwWPfac/kowXqgxZGlZLd2BpcIeCCo8D62tebClj89lcvKEooavkVn9QBr1Q1jqeT+VFnRG5wgVsxWcWxOH7uSgZZ4VuJvRH+KS00NZxKhYT806wStfXbl9ewhyUI4IdNcw0j2YoecEPa9miZbXNkXLcrTWkYzRP4Ux7tFwnH3bQ3fOHZiNo9uOx4p9pd96nS/c0ILRyHevD2tort3IybvMrCvi2QczMu+FG5l7GiPb9ey+NyNz/xdG5g39wdA9sJG5NaS8LiMzg2MameV1gCePBRF56DyXiAOBofZdHEwSPOWbjzcwq7IjKW2cUqTKhOnq0bwAsDErWgR6AacQqaIfqTgNX+Lui0JBPR0yuyjU4afdgzHIbzFoC8p3jEbzkJ9B3hVk5/Qg958L8nsWne34CYi9er7lnRxiHWKeCuM6opK0fMa8/SZ6a1RPRMXl6kqtEo+n5R+olIMN9SV4SZHmjbiaz3jGuXiIPhQ7YV+HUeb0SEizKQF4WS+EESEaIY7gS8iBntciLRE/jSnD2HiAfikzykojh2mBhmOrVoZlB71cXBoehyOBVU/srL7d4kjQkS1o2f4p0r630BH7bOgbQbTqIHbkfEGHnR8s49Nmfbbzn8bO9YN2He79U9t5+9pE5WxnM99o5vWny47bNnP/qGa+w6n8bObHNfN6OPf8jkhwVDNvn/3LrP1s5Dsauec4LQS9Yxq5236/5I9CAGi+FRs/RSE+g7npLZSg8Wwi2PEEtg8088W7/OOv7x8D4+7zlw9vkfW3dW+0z9j6WF3kKOu8i2u+IyDeZCjv3jbcxv1wR3WXHBM+m0+UJ35HM8RnKLu1s4g+Cqf8Bi9QeftuVN9GMMbjceV2UE6pdWlYF788DlcZuyqrFZh7oG+/8cZev+MCofMVhX3Qt/uVyRZ9b2kW0/GLhG9XF9QCbKe3NVfxpP48wO7KCI4JYftoeIbweRC6Rzzed0LYcXSjBY8Zvv9wc0ZxY2pev6TxO1Dseh31P6AIxfU/yMhHsOv/MnKu/gU=