A small utility library that easily enables an embedded ZooKeeper server on SpringBoot apps.
Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.raonigabriel</groupId>
<artifactId>spring-boot-embedded-zookeeper</artifactId>
<version>2.0.7</version>
</dependency>
Just add @EnableEmbeddedZooKeeper to any @Configuration or @SpringBootApplication class as follows:
package com.myco.myapp;
@EnableEmbeddedZooKeeper
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
Then you can inject the ZooKeeperServer bean on any Spring component, as following:
package com.myco.myapp;
@Component
public class MyComponent {
@Autowired
ZooKeeperServer zookeeperServer;
public void doSomething() {
// Use the injected zookeeperServer
}
}
Clone the repository:
$ git clone https://github.com/raonigabriel/spring-boot-embedded-zookeeper.git
If this is your first time using Github, review http://help.github.com to learn the basics.
Released under the Apache 2.0 license