diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml
index 5b5b006d01..6d53b24647 100644
--- a/spring-cloud/pom.xml
+++ b/spring-cloud/pom.xml
@@ -13,6 +13,7 @@
spring-cloud-bootstrap
spring-cloud-ribbon-client
spring-cloud-rest
+ spring-cloud-zookeeper
pom
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml
new file mode 100644
index 0000000000..4d19741210
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml
@@ -0,0 +1,78 @@
+
+
+ 4.0.0
+
+ com.baeldung.spring.cloud
+ spring-cloud-zookeeper
+ 1.0.0-SNAPSHOT
+
+ Greeting
+ jar
+
+
+ org.springframework.boot
+ spring-boot-starter
+ 1.5.2.RELEASE
+
+
+ org.springframework
+ spring-web
+ 4.3.7.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-starter-zookeeper-discovery
+ 1.0.3.RELEASE
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+ 1.5.2.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-starter-feign
+ 1.2.5.RELEASE
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+ 1.5.2.RELEASE
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ org.hamcrest
+ hamcrest-core
+ 1.3
+ test
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ Brixton.SR7
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ Greeting
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingApplication.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingApplication.java
new file mode 100644
index 0000000000..e8beebeadf
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingApplication.java
@@ -0,0 +1,27 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.spring.cloud.greeting;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@SpringBootApplication
+@EnableDiscoveryClient
+public class GreetingApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(GreetingApplication.class, args);
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingController.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingController.java
new file mode 100644
index 0000000000..d701a2c762
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/GreetingController.java
@@ -0,0 +1,33 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.spring.cloud.greeting;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.stereotype.Controller;
+
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@Controller
+public class GreetingController {
+
+ @Autowired
+ private HelloWorldClient helloWorldClient;
+
+ @RequestMapping(value = "/get-greeting", method = RequestMethod.GET)
+
+ public String greeting(Model model) {
+
+ model.addAttribute("greeting", helloWorldClient.HelloWorld());
+ return "greeting-view";
+
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java
new file mode 100644
index 0000000000..d2b91ca715
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java
@@ -0,0 +1,49 @@
+package com.baeldung.spring.cloud.greeting;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+/**
+ * This class provides operations on the Validation service.
+ *
+ *
+ * When booting up, Spring will try and find a service named "Validation" (see
+ * the FeignClient below) under the available ZooKeeper instance.
+ *
+ *
+ */
+@Configuration
+@EnableFeignClients
+@EnableDiscoveryClient
+public class HelloWorldClient {
+
+ @Autowired
+ private TheClient theClient;
+
+ @FeignClient(name = "HelloWorld")
+ interface TheClient {
+
+ @RequestMapping(path = "/helloworld", method = RequestMethod.GET)
+ @ResponseBody
+ String HelloWorld();
+ }
+
+ /**
+ * Initiate call to Validation.
+ *
+ * @param name
+ * @return the response
+ */
+ public String HelloWorld() {
+ return theClient.HelloWorld();
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/application.yml b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/application.yml
new file mode 100644
index 0000000000..6140f6ab2f
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/application.yml
@@ -0,0 +1,11 @@
+spring:
+ application:
+ name: Greeting
+ cloud:
+ zookeeper:
+ connect-string: localhost:2181
+server:
+ port: 8083
+logging:
+ level:
+ org.apache.zookeeper.ClientCnxn: WARN
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/templates/greeting-view.html b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/templates/greeting-view.html
new file mode 100644
index 0000000000..42cdadb487
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/templates/greeting-view.html
@@ -0,0 +1,9 @@
+
+
+
+ Greeting Page
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml b/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml
new file mode 100644
index 0000000000..1c829a50df
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/pom.xml
@@ -0,0 +1,51 @@
+
+
+ 4.0.0
+
+ com.baeldung.spring.cloud
+ spring-cloud-zookeeper
+ 1.0.0-SNAPSHOT
+
+ HelloWorld
+ jar
+
+
+ org.springframework.boot
+ spring-boot-starter
+ 1.5.2.RELEASE
+
+
+ org.springframework
+ spring-web
+ 4.3.7.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-starter-zookeeper-discovery
+ 1.0.3.RELEASE
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ Brixton.SR7
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ HelloWorld
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldApplication.java b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldApplication.java
new file mode 100644
index 0000000000..8b35071516
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldApplication.java
@@ -0,0 +1,18 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.spring.cloud.helloworld;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+@SpringBootApplication
+@EnableDiscoveryClient
+public class HelloWorldApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(HelloWorldApplication.class, args);
+ }
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldController.java b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldController.java
new file mode 100644
index 0000000000..d5ea84de19
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/java/com/baeldung/spring/cloud/helloworld/HelloWorldController.java
@@ -0,0 +1,21 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.baeldung.spring.cloud.helloworld;
+
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HelloWorldController {
+
+ @RequestMapping(path = "/helloworld", method = RequestMethod.GET)
+ public String HelloWorld() {
+ return "Hello World!";
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/application.yml b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/application.yml
new file mode 100644
index 0000000000..550165a762
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/application.yml
@@ -0,0 +1,16 @@
+spring:
+ application:
+ name: HelloWorld
+ cloud:
+ zookeeper:
+ connect-string: localhost:2181
+ discovery:
+ enabled: true
+server:
+ port: 8081
+endpoints:
+ restart:
+ enabled: true
+logging:
+ level:
+ org.apache.zookeeper.ClientCnxn: WARN
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/pom.xml b/spring-cloud/spring-cloud-zookeeper/pom.xml
new file mode 100644
index 0000000000..8406813161
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+
+ com.baeldung.spring.cloud
+ spring-cloud
+ 1.0.0-SNAPSHOT
+
+ spring-cloud-zookeeper
+ pom
+
+ Greeting
+ HelloWorld
+
+
\ No newline at end of file