diff --git a/microservice/.DS_Store b/microservice/.DS_Store new file mode 100644 index 0000000..ce3a1d9 Binary files /dev/null and b/microservice/.DS_Store differ diff --git a/microservice/configserver/.DS_Store b/microservice/configserver/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/microservice/configserver/.DS_Store differ diff --git a/microservice/configserver/pom.xml b/microservice/configserver/pom.xml new file mode 100644 index 0000000..2bf0ec4 --- /dev/null +++ b/microservice/configserver/pom.xml @@ -0,0 +1,70 @@ + + + + microservice + com.ayoosh + 0.0.1-SNAPSHOT + + 4.0.0 + + configserver + + + 1.8 + Hoxton.SR3 + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-jersey + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-config-server + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/microservice/configserver/src/main/java/com/ayoosh/configserver/ConfigserverApplication.java b/microservice/configserver/src/main/java/com/ayoosh/configserver/ConfigserverApplication.java new file mode 100644 index 0000000..4508206 --- /dev/null +++ b/microservice/configserver/src/main/java/com/ayoosh/configserver/ConfigserverApplication.java @@ -0,0 +1,15 @@ +package com.ayoosh.configserver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; + +@SpringBootApplication +@EnableConfigServer +public class ConfigserverApplication { + + public static void main(String[] args) { + SpringApplication.run(ConfigserverApplication.class, args); + } + +} diff --git a/microservice/configserver/src/main/resources/application.properties b/microservice/configserver/src/main/resources/application.properties new file mode 100644 index 0000000..5631ae9 --- /dev/null +++ b/microservice/configserver/src/main/resources/application.properties @@ -0,0 +1,6 @@ +server.port=8082 +spring.application.name=configserver +spring.cloud.config.server.git.uri = https://github.com/flopcoder82/microservices +spring.cloud.config.server.git.username=flopcoder82 +spring.cloud.config.server.git.password=Gitto@123 +spring.cloud.config.server.git.clone-on-start=true diff --git a/microservice/configserver/src/test/java/com/ayoosh/configserver/ConfigserverApplicationTests.java b/microservice/configserver/src/test/java/com/ayoosh/configserver/ConfigserverApplicationTests.java new file mode 100644 index 0000000..734d5bc --- /dev/null +++ b/microservice/configserver/src/test/java/com/ayoosh/configserver/ConfigserverApplicationTests.java @@ -0,0 +1,13 @@ +package com.ayoosh.configserver; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ConfigserverApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/microservice/dicoveryserver/.DS_Store b/microservice/dicoveryserver/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/microservice/dicoveryserver/.DS_Store differ diff --git a/microservice/dicoveryserver/pom.xml b/microservice/dicoveryserver/pom.xml new file mode 100644 index 0000000..c3b0f32 --- /dev/null +++ b/microservice/dicoveryserver/pom.xml @@ -0,0 +1,69 @@ + + + + microservice + com.ayoosh + 0.0.1-SNAPSHOT + + 4.0.0 + + dicoveryserver + + + 1.8 + Hoxton.SR3 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-server + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/microservice/dicoveryserver/src/main/java/com/ayoosh/discoveryserver/DiscoveryserverApplication.java b/microservice/dicoveryserver/src/main/java/com/ayoosh/discoveryserver/DiscoveryserverApplication.java new file mode 100644 index 0000000..9e30cb0 --- /dev/null +++ b/microservice/dicoveryserver/src/main/java/com/ayoosh/discoveryserver/DiscoveryserverApplication.java @@ -0,0 +1,15 @@ +package com.ayoosh.discoveryserver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer +public class DiscoveryserverApplication { + + public static void main(String[] args) { + SpringApplication.run(DiscoveryserverApplication.class, args); + } + +} diff --git a/microservice/dicoveryserver/src/main/resources/application.properties b/microservice/dicoveryserver/src/main/resources/application.properties new file mode 100644 index 0000000..618bd49 --- /dev/null +++ b/microservice/dicoveryserver/src/main/resources/application.properties @@ -0,0 +1,5 @@ +spring.application.name=discoveryserver +server.port=8081 +eureka.client.register-with-eureka=false +eureka.client.fetch-registry=false + diff --git a/microservice/dicoveryserver/src/test/java/com/ayoosh/discoveryserver/DiscoveryserverApplicationTests.java b/microservice/dicoveryserver/src/test/java/com/ayoosh/discoveryserver/DiscoveryserverApplicationTests.java new file mode 100644 index 0000000..633f064 --- /dev/null +++ b/microservice/dicoveryserver/src/test/java/com/ayoosh/discoveryserver/DiscoveryserverApplicationTests.java @@ -0,0 +1,13 @@ +package com.ayoosh.discoveryserver; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DiscoveryserverApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/microservice/pom.xml b/microservice/pom.xml new file mode 100644 index 0000000..4b091e2 --- /dev/null +++ b/microservice/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + pom + + dicoveryserver + configserver + profilemanagement + + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + + + com.ayoosh + microservice + 0.0.1-SNAPSHOT + microservice + Microservices with spring boot + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/microservice/profilemanagement/.DS_Store b/microservice/profilemanagement/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/microservice/profilemanagement/.DS_Store differ diff --git a/microservice/profilemanagement/pom.xml b/microservice/profilemanagement/pom.xml new file mode 100644 index 0000000..06b7601 --- /dev/null +++ b/microservice/profilemanagement/pom.xml @@ -0,0 +1,66 @@ + + + + microservice + com.ayoosh + 0.0.1-SNAPSHOT + + 4.0.0 + + profilemanagement + + + 1.8 + Hoxton.SR3 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/ProfilemanagementApplication.java b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/ProfilemanagementApplication.java new file mode 100644 index 0000000..c526616 --- /dev/null +++ b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/ProfilemanagementApplication.java @@ -0,0 +1,17 @@ +package com.ayoosh.profilemanagement; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +@SpringBootApplication +@EnableEurekaClient +@EnableDiscoveryClient +public class ProfilemanagementApplication { + + public static void main(String[] args) { + SpringApplication.run(ProfilemanagementApplication.class, args); + } + +} diff --git a/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/controller/EmployeeController.java b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/controller/EmployeeController.java new file mode 100644 index 0000000..8cf8117 --- /dev/null +++ b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/controller/EmployeeController.java @@ -0,0 +1,26 @@ +package com.ayoosh.profilemanagement.controller; + +import com.ayoosh.profilemanagement.domain.EmployeeProfile; +import com.ayoosh.profilemanagement.service.EmployeeProfileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping(value = "/") +public class EmployeeController { + @Autowired + EmployeeProfileService employeeProfileService; + + @PostMapping + public void saveEmployeeProfile(@RequestBody EmployeeProfile employeeProfile){ + employeeProfileService.addEmployeeProfile(employeeProfile); + } + + @GetMapping + public List getAllEmployee(){ + return employeeProfileService.getEmployeeProfiles(); + } + +} diff --git a/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/domain/EmployeeProfile.java b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/domain/EmployeeProfile.java new file mode 100644 index 0000000..9e8eefc --- /dev/null +++ b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/domain/EmployeeProfile.java @@ -0,0 +1,32 @@ +package com.ayoosh.profilemanagement.domain; + +public class EmployeeProfile { + private int id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + private String name; + private String address; +} diff --git a/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileService.java b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileService.java new file mode 100644 index 0000000..0899f1c --- /dev/null +++ b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileService.java @@ -0,0 +1,10 @@ +package com.ayoosh.profilemanagement.service; + +import com.ayoosh.profilemanagement.domain.EmployeeProfile; + +import java.util.List; + +public interface EmployeeProfileService { + void addEmployeeProfile(EmployeeProfile profile); + List getEmployeeProfiles(); +} diff --git a/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileServiceImpl.java b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileServiceImpl.java new file mode 100644 index 0000000..298972a --- /dev/null +++ b/microservice/profilemanagement/src/main/java/com/ayoosh/profilemanagement/service/EmployeeProfileServiceImpl.java @@ -0,0 +1,22 @@ +package com.ayoosh.profilemanagement.service; + +import com.ayoosh.profilemanagement.domain.EmployeeProfile; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class EmployeeProfileServiceImpl implements EmployeeProfileService { + List employeeProfileList = new ArrayList<>(); + + @Override + public void addEmployeeProfile(EmployeeProfile profile) { + employeeProfileList.add(profile); + } + + @Override + public List getEmployeeProfiles() { + return employeeProfileList; + } +} diff --git a/microservice/profilemanagement/src/main/resources/application.properties b/microservice/profilemanagement/src/main/resources/application.properties new file mode 100644 index 0000000..56e8e97 --- /dev/null +++ b/microservice/profilemanagement/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=profilemanagement diff --git a/microservice/profilemanagement/src/main/resources/bootstrap.properties b/microservice/profilemanagement/src/main/resources/bootstrap.properties new file mode 100644 index 0000000..cc1bec3 --- /dev/null +++ b/microservice/profilemanagement/src/main/resources/bootstrap.properties @@ -0,0 +1,3 @@ +spring.cloud.config.uri=http://localhost:8082 +spring.cloud.config.name=profilemanagement +spring.cloud.config.profile=active \ No newline at end of file diff --git a/microservice/profilemanagement/src/test/java/com/ayoosh/profilemanagement/ProfilemanagementApplicationTests.java b/microservice/profilemanagement/src/test/java/com/ayoosh/profilemanagement/ProfilemanagementApplicationTests.java new file mode 100644 index 0000000..17d6b9a --- /dev/null +++ b/microservice/profilemanagement/src/test/java/com/ayoosh/profilemanagement/ProfilemanagementApplicationTests.java @@ -0,0 +1,13 @@ +package com.ayoosh.profilemanagement; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ProfilemanagementApplicationTests { + + @Test + void contextLoads() { + } + +}