diff --git a/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/JDJCore.java b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/JDJCore.java new file mode 100644 index 0000000..51a00d0 --- /dev/null +++ b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/JDJCore.java @@ -0,0 +1,9 @@ +package com.javadevjournal; + +//@SpringBootApplication +public class JDJCore { + + public static void main(String[] args) { + + } +} diff --git a/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/data/customer/Customer.java b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/data/customer/Customer.java new file mode 100644 index 0000000..27b06ad --- /dev/null +++ b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/data/customer/Customer.java @@ -0,0 +1,51 @@ +package com.javadevjournal.data.customer; + +public class Customer { + + private String firstName; + private String lastName; + private String id; + private String email; + + public Customer() { + } + + public Customer(String firstName, String lastName, String id, String email) { + this.firstName = firstName; + this.lastName = lastName; + this.id = id; + this.email = email; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/CustomerService.java b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/CustomerService.java new file mode 100644 index 0000000..f0da2fc --- /dev/null +++ b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/CustomerService.java @@ -0,0 +1,8 @@ +package com.javadevjournal.service.customer; + +import com.javadevjournal.data.customer.Customer; + +public interface CustomerService { + + Customer getCustomerById(final String id); +} diff --git a/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/DefaultCustomerService.java b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/DefaultCustomerService.java new file mode 100644 index 0000000..5076495 --- /dev/null +++ b/Spring-Boot/spring-boot-multi-module-project/jdj-core/src/main/java/com/javadevjournal/service/customer/DefaultCustomerService.java @@ -0,0 +1,13 @@ +package com.javadevjournal.service.customer; + +import com.javadevjournal.data.customer.Customer; +import org.springframework.stereotype.Service; + +@Service("customerService") +public class DefaultCustomerService implements CustomerService { + + @Override + public Customer getCustomerById(String id) { + return new Customer("Test","Customer",id,"contact-us@javadevjournal.com"); + } +} diff --git a/Spring-Boot/spring-boot-multi-module-project/jdj-web/src/main/java/com/javadevjournal/controller/CustomerController.java b/Spring-Boot/spring-boot-multi-module-project/jdj-web/src/main/java/com/javadevjournal/controller/CustomerController.java new file mode 100644 index 0000000..31927fe --- /dev/null +++ b/Spring-Boot/spring-boot-multi-module-project/jdj-web/src/main/java/com/javadevjournal/controller/CustomerController.java @@ -0,0 +1,23 @@ +package com.javadevjournal.controller; + +import com.javadevjournal.data.customer.Customer; +import com.javadevjournal.service.customer.CustomerService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/customers") +public class CustomerController { + + @Resource(name = "customerService") + CustomerService customerService; + + @GetMapping("/customer/{id}") + public Customer getCustomer(@PathVariable String id){ + return customerService.getCustomerById(id); + } +}