From 4c0a72d6e777b9f7b30cea0e274f8803c46fb169 Mon Sep 17 00:00:00 2001 From: DOHA Date: Wed, 25 Jan 2017 23:35:30 +0200 Subject: [PATCH] configure discovery and resource servers --- .../application-config/resource.properties | 2 +- .../src/main/resources/bootstrap.properties | 5 ++++- .../src/main/resources/application.properties | 19 ------------------- .../src/main/resources/bootstrap.properties | 6 ++++++ .../SpringCloudRestConfigApplication.java | 3 ++- .../src/main/resources/application.properties | 8 ++++---- 6 files changed, 17 insertions(+), 26 deletions(-) delete mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/bootstrap.properties diff --git a/spring-cloud/spring-cloud-rest/application-config/resource.properties b/spring-cloud/spring-cloud-rest/application-config/resource.properties index 8add49ab7e..759bb87895 100644 --- a/spring-cloud/spring-cloud-rest/application-config/resource.properties +++ b/spring-cloud/spring-cloud-rest/application-config/resource.properties @@ -1,5 +1,5 @@ spring.application.name=resource -server.port=0 +#server.port=0 #### cloud eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://system:systemPass@localhost:8761/eureka} diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-1/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-1/src/main/resources/bootstrap.properties index f34f1b65ac..a5a8eef7b0 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-1/src/main/resources/bootstrap.properties +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-1/src/main/resources/bootstrap.properties @@ -1,3 +1,6 @@ spring.cloud.config.name=resource spring.cloud.config.discovery.service-id=config -spring.cloud.config.discovery.enabled=true \ No newline at end of file +spring.cloud.config.discovery.enabled=true +eureka.client.serviceUrl.defaultZone=http://system:systemPass@localhost:8761/eureka + +server.port=8086 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/application.properties b/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/application.properties deleted file mode 100644 index f443e86fd8..0000000000 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/application.properties +++ /dev/null @@ -1,19 +0,0 @@ -#### cloud -spring.application.name=spring-cloud-eureka-client -server.port=0 -eureka.client.serviceUrl.defaultZone=http://system:systemPass@localhost:8761/eureka -eureka.instance.preferIpAddress=true - -#### persistence -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.url=jdbc:h2:mem:cloud_rest;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE -spring.datasource.username=sa -spring.datasource.password= - -#### security -security.basic.enabled=true -security.basic.path=/** -security.user.name=user -security.user.password=userPass -security.user.role=USER -security.sessions=always \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..ef11a62b53 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-client-2/src/main/resources/bootstrap.properties @@ -0,0 +1,6 @@ +spring.cloud.config.name=resource +spring.cloud.config.discovery.service-id=config +spring.cloud.config.discovery.enabled=true +eureka.client.serviceUrl.defaultZone=http://system:systemPass@localhost:8761/eureka + +server.port=8085 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/java/org/baeldung/SpringCloudRestConfigApplication.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/java/org/baeldung/SpringCloudRestConfigApplication.java index 20e1589d5e..90c6fe3ec9 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/java/org/baeldung/SpringCloudRestConfigApplication.java +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/java/org/baeldung/SpringCloudRestConfigApplication.java @@ -3,10 +3,11 @@ package org.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableConfigServer -// @EnableEurekaClient +@EnableEurekaClient public class SpringCloudRestConfigApplication { public static void main(String[] args) { diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/resources/application.properties b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/resources/application.properties index 42fed8d0ba..5b413e1d96 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config/src/main/resources/application.properties @@ -1,8 +1,8 @@ server.port=8081 spring.application.name=config -spring.cloud.config.server.git.uri=https://github.com/eugenp/tutorials/tree/master/spring-cloud/spring-cloud-rest/application-config +spring.cloud.config.server.git.uri=${HOME}/application-config -#eureka.client.region = default -#eureka.client.registryFetchIntervalSeconds = 5 -#eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://system:systemPass@localhost:8761/eureka} +eureka.client.region = default +eureka.client.registryFetchIntervalSeconds = 5 +eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://system:systemPass@localhost:8761/eureka}