@Bean @SneakyThrows public ServiceDiscovery<ZookeeperInstance> serviceDiscovery( CuratorFramework curatorFramework, InstanceSerializer<ZookeeperInstance> instanceSerializer, ZookeeperDiscoveryProperties zookeeperProperties) { ServiceDiscovery<ZookeeperInstance> serviceDiscovery = ServiceDiscoveryBuilder.builder(ZookeeperInstance.class) .client(curatorFramework) .basePath(zookeeperProperties.getRoot()) .serializer(instanceSerializer) .build(); serviceDiscovery.start(); return serviceDiscovery; }
public void start() throws Exception { serviceDiscovery.start(); }