-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c520079
commit 075e810
Showing
38 changed files
with
954 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM openjdk:8 | ||
|
||
VOLUME /tmp | ||
RUN mkdir /microservice | ||
WORKDIR /microservice | ||
COPY ./target/config-server.jar ./config-server.jar | ||
RUN bash -c 'touch config-server.jar' | ||
|
||
CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "config-server.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>br.com.dodz</groupId> | ||
<artifactId>config-server</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>config-server</name> | ||
<description>Spring Cloud Config Server</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.6.RELEASE</version> | ||
<relativePath /> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<spring-cloud.version>Dalston.SR2</spring-cloud.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-eureka</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-hystrix</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring Cloud Stuff --> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-config-server</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring Cloud Bus --> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-bus-amqp</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<finalName>${project.name}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
config-server/src/main/java/br/com/dodz/configserver/ConfigServerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package br.com.dodz.configserver; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.cloud.client.SpringCloudApplication; | ||
import org.springframework.cloud.config.server.EnableConfigServer; | ||
|
||
@EnableConfigServer | ||
@SpringCloudApplication | ||
public class ConfigServerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ConfigServerApplication.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
______ ______ .__ __. _______ __ _______ _______. _______ .______ ____ ____ _______ .______ | ||
/ | / __ \ | \ | | | ____|| | / _____| / || ____|| _ \ \ \ / / | ____|| _ \ | ||
| ,----'| | | | | \| | | |__ | | | | __ | (----`| |__ | |_) | \ \/ / | |__ | |_) | | ||
| | | | | | | . ` | | __| | | | | |_ | \ \ | __| | / \ / | __| | / | ||
| `----.| `--' | | |\ | | | | | | |__| | .----) | | |____ | |\ \----. \ / | |____ | |\ \----. | ||
\______| \______/ |__| \__| |__| |__| \______| |_______/ |_______|| _| `._____| \__/ |_______|| _| `._____| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
server.port: 8888 | ||
|
||
spring: | ||
application: | ||
name: config-server | ||
index: ${random.int} | ||
cloud.config: | ||
server: | ||
git.uri: https://github.com/chavesrodolfo/poc-microservices-config.git | ||
bootstrap: true |
24 changes: 12 additions & 12 deletions
24
.../dodz/eurekaclientone/FeignClientTwo.java → ...eurekaclientone/FeignEurekaClientTwo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package br.com.dodz.eurekaclientone; | ||
|
||
import org.springframework.cloud.netflix.feign.FeignClient; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
@FeignClient(value = "client-two") | ||
public interface FeignClientTwo { | ||
|
||
@RequestMapping(value = "/api/hi", method = RequestMethod.GET) | ||
String sayHiByClientTwo(); | ||
} | ||
package br.com.dodz.eurekaclientone; | ||
|
||
import org.springframework.cloud.netflix.feign.FeignClient; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
@FeignClient(value = "eureka-client-two") | ||
public interface FeignEurekaClientTwo { | ||
|
||
@RequestMapping(value = "/api/hi", method = RequestMethod.GET) | ||
String sayHiByEurekaClientTwo(); | ||
} |
54 changes: 27 additions & 27 deletions
54
eureka-client-one/src/main/java/br/com/dodz/eurekaclientone/RestService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
package br.com.dodz.eurekaclientone; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
public class RestService { | ||
|
||
@Autowired | ||
private FeignClientTwo feignClientTwo; | ||
|
||
@RequestMapping(value = "/hi", method = RequestMethod.GET) | ||
public ResponseEntity<String> sayHi() { | ||
return new ResponseEntity<>("Hi From Cliente One!", HttpStatus.OK); | ||
} | ||
|
||
@RequestMapping(value = "/hy", method = RequestMethod.GET) | ||
public ResponseEntity<String> sayHiUsingClientTwo() { | ||
return new ResponseEntity<>(feignClientTwo.sayHiByClientTwo() + " using Hystrix.", HttpStatus.OK); | ||
} | ||
|
||
} | ||
package br.com.dodz.eurekaclientone; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
public class RestService { | ||
|
||
@Autowired | ||
private FeignEurekaClientTwo feignEurekaClientTwo; | ||
|
||
@RequestMapping(value = "/hi", method = RequestMethod.GET) | ||
public ResponseEntity<String> sayHi() { | ||
return new ResponseEntity<>("Hi From Cliente One!", HttpStatus.OK); | ||
} | ||
|
||
@RequestMapping(value = "/hy", method = RequestMethod.GET) | ||
public ResponseEntity<String> sayHiUsingClientTwo() { | ||
return new ResponseEntity<>(feignEurekaClientTwo.sayHiByEurekaClientTwo() + " using Feign.", HttpStatus.OK); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.___ ___. __ ______ .______ ______ _______. _______ .______ ____ ____ __ ______ _______ | ||
| \/ | | | / || _ \ / __ \ / || ____|| _ \ \ \ / / | | / || ____| | ||
| \ / | | | | ,----'| |_) | | | | | | (----`| |__ | |_) | \ \/ / | | | ,----'| |__ | ||
| |\/| | | | | | | / | | | | \ \ | __| | / \ / | | | | | __| | ||
| | | | | | | `----.| |\ \----.| `--' | .----) | | |____ | |\ \----. \ / | | | `----.| |____ | ||
|__| |__| |__| \______|| _| `._____| \______/ |_______/ |_______|| _| `._____| \__/ |__| \______||_______| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONFIG_SERVER_URL: http://127.0.0.1:8888 | ||
|
||
server: | ||
port: 8081 | ||
|
||
spring: | ||
application: | ||
name: eureka-client-one | ||
cloud: | ||
config: | ||
uri: ${CONFIG_SERVER_URL} | ||
fail-fast: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.___ ___. __ ______ .______ ______ _______. _______ .______ ____ ____ __ ______ _______ | ||
| \/ | | | / || _ \ / __ \ / || ____|| _ \ \ \ / / | | / || ____| | ||
| \ / | | | | ,----'| |_) | | | | | | (----`| |__ | |_) | \ \/ / | | | ,----'| |__ | ||
| |\/| | | | | | | / | | | | \ \ | __| | / \ / | | | | | __| | ||
| | | | | | | `----.| |\ \----.| `--' | .----) | | |____ | |\ \----. \ / | | | `----.| |____ | ||
|__| |__| |__| \______|| _| `._____| \______/ |_______/ |_______|| _| `._____| \__/ |__| \______||_______| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONFIG_SERVER_URL: http://127.0.0.1:8888 | ||
|
||
server: | ||
port: 8082 | ||
|
||
spring: | ||
application: | ||
name: eureka-client-two | ||
cloud: | ||
config: | ||
uri: ${CONFIG_SERVER_URL} | ||
fail-fast: true |
Oops, something went wrong.