close

Spring Cloud Zookeeper

2.2.3.RELEASE

Unresolved directive in <stdin> - include::_attributes.adoc[]

Spring Cloud Zookeeper provides Apache Zookeeper integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with Zookeeper. The patterns provided include Service Discovery and Distributed Configuration.

Features

  • Service Discovery: instances can be registered with Zookeeper and clients can discover the instances using Spring-managed beans

  • Supports Spring Cloud LoadBalancer - client-side load-balancing solution

  • Supports Spring Cloud OpenFeign

  • Distributed Configuration: using Zookeeper as a data store

Quick Start

As long as Spring Cloud Zookeeper, Apache Curator and the Zookeeper Java Client are on the classpath any Spring Boot application with @EnableDiscoveryClient will try to contact a Zookeeper agent on localhost:2181 (the default value of zookeeper.connectString).

@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@RestController
public class Application {

  @RequestMapping("/")
  public String home() {
    return "Hello World";
  }

  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }

}

A local Zookeeper server must be running. See the Zookeeper documentation on how to run a Zookeeper server.

Spring Boot Config

Unresolved directive in <stdin> - include::_attributes.adoc[]

Spring Initializr

Quickstart Your Project

Bootstrap your application with Spring Initializr.

Documentation

Each Spring project has its own; it explains in great details how you can use project features and what you can achieve with them.
2.2.3.RELEASE CURRENT GA Reference Doc. API Doc.
3.0.0-SNAPSHOT SNAPSHOT Reference Doc. API Doc.
3.0.0-M3 PRE Reference Doc. API Doc.
2.2.4.BUILD-SNAPSHOT SNAPSHOT Reference Doc. API Doc.
2.1.4.RELEASE GA Reference Doc. API Doc.

A few examples to try out: