Coder Social home page Coder Social logo

spring-cloud / spring-cloud-zookeeper Goto Github PK

View Code? Open in Web Editor NEW
555.0 74.0 411.0 30.18 MB

Spring Cloud Zookeeper

Home Page: http://cloud.spring.io/spring-cloud-zookeeper/

License: Apache License 2.0

Java 99.92% Shell 0.08%
java spring-boot spring spring-cloud service-discovery configuration microservices cloud-native zookeeper spring-cloud-core

spring-cloud-zookeeper's Introduction

Actions Status

Quick Start

Zookeeper overview

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. See the Zookeeper site for more information. Spring Cloud Zookeeper also builds on the Apache Curator project, which started life at Netflix.

Spring Cloud Zookeeper Features

Spring Cloud Zookeeper includes the following features:

  • Spring Cloud DiscoveryClient implementation (supports Spring Cloud LoadBalancer)

  • Zookeeper-based PropertySource loaded during the 'bootstrap' phase

Running the Sample

  1. Install zookeeper (On a mac with homebrew, use brew install zookeeper).

  2. Start zookeeper.

  3. Verify zookeeper is running.

  4. Run mvn --settings .settings.xml package. Doing so brings in the required Spring Cloud Maven repositories and Build.

  5. Run java -jar spring-cloud-zookeeper-sample/target/spring-cloud-zookeeper-sample-1.2.0.BUILD-SNAPSHOT.jar.

  6. Visit http://localhost:8080 to verify that {"serviceId":"testZookeeperApp","host":"<yourhost>","port":8080} works.

  7. Run java -jar spring-cloud-zookeeper-sample/target/spring-cloud-zookeeper-sample-1.2.0.BUILD-SNAPSHOT.jar --server.port=8081

  8. Visit http://localhost:8080 again to verify that {"serviceId":"testZookeeperApp","host":"<yourhost>","port":8081} eventually shows up in the results in a round-robin fashion. (It may take a minute or so.)

Building

Basic Compile and Test

To build the source you will need to install JDK 17.

Spring Cloud uses Maven for most build-related activities, and you should be able to get off the ground quite quickly by cloning the project you are interested in and typing

$ ./mvnw install
Note
You can also install Maven (>=3.3.3) yourself and run the mvn command in place of ./mvnw in the examples below. If you do that you also might need to add -P spring if your local Maven settings do not contain repository declarations for spring pre-release artifacts.
Note
Be aware that you might need to increase the amount of memory available to Maven by setting a MAVEN_OPTS environment variable with a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in the .mvn configuration, so if you find you have to do it to make a build succeed, please raise a ticket to get the settings added to source control.

The projects that require middleware (i.e. Redis) for testing generally require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running.

Documentation

The spring-cloud-build module has a "docs" profile, and if you switch that on it will try to build asciidoc sources using Antora from modules/ROOT/.

As part of that process it will look for a docs/src/main/asciidoc/README.adoc and process it by loading all the includes, but not parsing or rendering it, just copying it to ${main.basedir} (defaults to ${basedir}, i.e. the root of the project). If there are any changes in the README it will then show up after a Maven build as a modified file in the correct place. Just commit it and push the change.

Working with the code

If you don’t have an IDE preference we would recommend that you use Spring Tools Suite or Eclipse when working with the code. We use the m2eclipse eclipse plugin for maven support. Other IDEs and tools should also work without issue as long as they use Maven 3.3.3 or better.

Activate the Spring Maven profile

Spring Cloud projects require the 'spring' Maven profile to be activated to resolve the spring milestone and snapshot repositories. Use your preferred IDE to set this profile to be active, or you may experience build errors.

Importing into eclipse with m2eclipse

We recommend the m2eclipse eclipse plugin when working with eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse marketplace".

Note
Older versions of m2e do not support Maven 3.3, so once the projects are imported into Eclipse you will also need to tell m2eclipse to use the right profile for the projects. If you see many different errors related to the POMs in the projects, check that you have an up to date installation. If you can’t upgrade m2e, add the "spring" profile to your settings.xml. Alternatively you can copy the repository settings from the "spring" profile of the parent pom into your settings.xml.

Importing into eclipse without m2eclipse

If you prefer not to use m2eclipse you can generate eclipse project metadata using the following command:

$ ./mvnw eclipse:eclipse

The generated eclipse projects can be imported by selecting import existing projects from the file menu.

Contributing

Spring Cloud is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into main. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.

Sign the Contributor License Agreement

Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

  • Use the Spring Framework code format conventions. If you use Eclipse you can import formatter settings using the eclipse-code-formatter.xml file from the Spring Cloud Build project. If using IntelliJ, you can use the Eclipse Code Formatter Plugin to import the same file.

  • Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.

  • Add the ASF license header comment to all new .java files (copy from existing files in the project)

  • Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).

  • Add some Javadocs and, if you change the namespace, some XSD doc elements.

  • A few unit tests would help a lot as well — someone has to do it.

  • If no-one else is using your branch, please rebase it against the current main (or other target branch in the main project).

  • When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit message (where XXXX is the issue number).

Checkstyle

Spring Cloud Build comes with a set of checkstyle rules. You can find them in the spring-cloud-build-tools module. The most notable files under the module are:

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            └── checkstyle.xml (1)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

Checkstyle configuration

Checkstyle rules are disabled by default. To add checkstyle to your project just define the following properties and plugins.

pom.xml
<properties>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> (1)
        <maven-checkstyle-plugin.failsOnViolation>true
        </maven-checkstyle-plugin.failsOnViolation> (2)
        <maven-checkstyle-plugin.includeTestSourceDirectory>true
        </maven-checkstyle-plugin.includeTestSourceDirectory> (3)
</properties>

<build>
        <plugins>
            <plugin> (4)
                <groupId>io.spring.javaformat</groupId>
                <artifactId>spring-javaformat-maven-plugin</artifactId>
            </plugin>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>

    <reporting>
        <plugins>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</build>
  1. Fails the build upon Checkstyle errors

  2. Fails the build upon Checkstyle violations

  3. Checkstyle analyzes also the test sources

  4. Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules

  5. Add checkstyle plugin to your build and reporting phases

If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under ${project.root}/src/checkstyle/checkstyle-suppressions.xml with your suppressions. Example:

projectRoot/src/checkstyle/checkstyle-suppresions.xml
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
		"-//Puppy Crawl//DTD Suppressions 1.1//EN"
		"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
	<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
	<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
</suppressions>

It’s advisable to copy the ${spring-cloud-build.rootFolder}/.editorconfig and ${spring-cloud-build.rootFolder}/.springformat to your project. That way, some default formatting rules will be applied. You can do so by running this script:

$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
$ touch .springformat

IDE setup

Intellij IDEA

In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project.

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            ├── checkstyle.xml (1)
            └── intellij
                ├── Intellij_Project_Defaults.xml (4)
                └── Intellij_Spring_Boot_Java_Conventions.xml (5)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

  4. Project defaults for Intellij that apply most of Checkstyle rules

  5. Project style conventions for Intellij that apply most of Checkstyle rules

Code style
Figure 1. Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Code style
Figure 2. Inspection profiles

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle

To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

Important
Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

Duplicate Finder

Spring Cloud Build brings along the basepom:duplicate-finder-maven-plugin, that enables flagging duplicate and conflicting classes and resources on the java classpath.

Duplicate Finder configuration

Duplicate finder is enabled by default and will run in the verify phase of your Maven build, but it will only take effect in your project if you add the duplicate-finder-maven-plugin to the build section of the projecst’s pom.xml.

pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

For other properties, we have set defaults as listed in the plugin documentation.

You can easily override them but setting the value of the selected property prefixed with duplicate-finder-maven-plugin. For example, set duplicate-finder-maven-plugin.skip to true in order to skip duplicates check in your build.

If you need to add ignoredClassPatterns or ignoredResourcePatterns to your setup, make sure to add them in the plugin configuration section of your project:

<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
            <configuration>
                <ignoredClassPatterns>
                    <ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
                    <ignoredClassPattern>.*module-info</ignoredClassPattern>
                </ignoredClassPatterns>
                <ignoredResourcePatterns>
                    <ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
                </ignoredResourcePatterns>
            </configuration>
        </plugin>
    </plugins>
</build>

spring-cloud-zookeeper's People

Contributors

alfredodiaz avatar andreasevers avatar berngp avatar buzzardo avatar codefromthecrypt avatar cs4r avatar dependabot-preview[bot] avatar dstepanov avatar erecarte avatar gdarmont avatar kbastani avatar marcingrzejszczak avatar me3x avatar mixamlv avatar msievers avatar olgamaciaszek avatar pengfei-lu avatar reda-alaoui avatar ryanjbaxter avatar spencergibb avatar spring-builds avatar spring-operator avatar stliu avatar tgianos avatar thomasvitale avatar tysewyn avatar u-dogff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-cloud-zookeeper's Issues

UnsatisfiedDependencyException when using spring.cloud.zookeeper.enabled=false

My intention is to disable Spring Cloud Zookeeper, for example in a test profile. I know there is spring.cloud.zookeeper.enabled for which I couldn't find documentation and I use it this way:

pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zookeeper-config</artifactId>
        </dependency>
    </dependencies>

bootstrap.yml

spring.cloud.zookeeper.enabled=false

The following exception gets logged upon application start

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertySourceBootstrapConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.List org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.propertySourceLocators; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zookeeperPropertySourceLocator' defined in org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.curator.framework.CuratorFramework]: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:140) ~[spring-cloud-context-1.1.0.RC2.jar:1.1.0.RC2]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84) ~[spring-cloud-context-1.1.0.RC2.jar:1.1.0.RC2]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:1) ~[spring-cloud-context-1.1.0.RC2.jar:1.1.0.RC2]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at localhost.TestApplication.main(TestApplication.java:10) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.List org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.propertySourceLocators; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zookeeperPropertySourceLocator' defined in org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.curator.framework.CuratorFramework]: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    ... 28 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zookeeperPropertySourceLocator' defined in org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.curator.framework.CuratorFramework]: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1068) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    ... 30 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.curator.framework.CuratorFramework] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    ... 43 common frames omitted

Is it possible to disable Spring Cloud Zookeeper using spring.cloud.zookeeper.enabled?

Using ".dependencies." infix as a part of property

Due to cloud-zookeeper uses ".dependencies." in some of properties e.g. spring.cloud.zookeeper.dependencies.ribbon.enabled during auto-configuration when property is set org.springframework.cloud.zookeeper.discovery.dependency.ZookeeperDependencies field dependecies is polluted by w this property. That may lead to wrong behaviors.

Configuration to change connectString

I'm trying to change the default connectString but is not working. This is my application.properties

spring.cloud.zookeeper.enabled = true
spring.cloud.zookeeper.connectString = 192.168.40.82:2181
zookeeper.connectString = 192.168.40.82:2181

But the class ZookeeperProperties does not load the properties.
Related to #35 ?

Feature Request: Support ZK ACLs per Profile, per Application

It's often desirable to restrict visibility of application properties such that an application running in DEV can't accidentally (or otherwise) use properties from PROD, or vice versa. It would also be desirable to prevent one application from accessing the properties of another.

Zookeeper ACLs seem like the obvious choice for implementing this. It would be great if you could associate an authId and password with each profile in an application that would be used by spring-cloud-zookeeper when accessing ZK nodes.

spring-cloud-zookeeper-config refactor issue

spring-cloud-zookeeper-config/src/main/resources/META-INF/spring.factories still references to
org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration but it was refactored to org.springframework.cloud.zookeeper.common.ZookeeperConfigBootstrapConfiguration by marcingrzejszczak with commit 85a139f. Applications depending on spring-cloud-zookeeper-all are failing with error "ClassNotFoundException" at runtime. Please provide fast support.

Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.zookeeper.config.ZookeeperConfigBootstrapConfiguration
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.LauncherssLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
        at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:284)
        ... 14 more      

Spring Cloud Zookeeper with Netflix Zuul does not work

I'm trying to use Netflix Zuul Proxy with Spring Cloud Zookeeper and it is not working.

I have this project https://github.com/sigrist/zookeeper-sandbox/tree/zuul/zookeeper-sandbox with the Application class that starts up a rest controller and register itself with Zookeeper. So far, so good, but if I add the @EnableZuulProxy annotation, looks like the lifecycle to load is different and got this exception:


org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at hello.Application.main(Application.java:28) [classes/:na]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:452) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:167) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    ... 8 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.netflix.zuul.ZuulConfiguration$ZuulFilterConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.Map org.springframework.cloud.netflix.zuul.ZuulConfiguration$ZuulFilterConfiguration.filters; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'preDecorationFilter' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter]: Factory method 'preDecorationFilter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeLocator' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:232) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:180) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:161) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:78) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:235) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:222) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:85) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:207) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:55) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5170) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) ~[tomcat-embed-core-8.0.28.jar:8.0.28]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_45]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_45]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.Map org.springframework.cloud.netflix.zuul.ZuulConfiguration$ZuulFilterConfiguration.filters; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'preDecorationFilter' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter]: Factory method 'preDecorationFilter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeLocator' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 33 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'preDecorationFilter' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter]: Factory method 'preDecorationFilter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeLocator' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1103) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 35 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter]: Factory method 'preDecorationFilter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeLocator' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 47 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeLocator' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.routeLocator(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration.preDecorationFilter(ZuulProxyConfiguration.java:90) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.CGLIB$preDecorationFilter$4(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74$$FastClassBySpringCGLIB$$46f501c9.invoke(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.preDecorationFilter(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 48 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 69 common frames omitted
Caused by: java.lang.IllegalArgumentException: serviceInstance has not been built
    at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.cloud.zookeeper.discovery.ZookeeperServiceDiscovery.getServiceInstance(ZookeeperServiceDiscovery.java:80) ~[spring-cloud-zookeeper-discovery-1.0.0.M3.jar:1.0.0.M3]
    at org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClient.getLocalServiceInstance(ZookeeperDiscoveryClient.java:54) ~[spring-cloud-zookeeper-discovery-1.0.0.M3.jar:1.0.0.M3]
    at org.springframework.cloud.netflix.zuul.filters.ProxyRouteLocator.<init>(ProxyRouteLocator.java:70) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration.routeLocator(ZuulProxyConfiguration.java:77) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.CGLIB$routeLocator$2(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74$$FastClassBySpringCGLIB$$46f501c9.invoke(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.routeLocator(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration.routeLocator(ZuulProxyConfiguration.java:51) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.CGLIB$routeLocator$1(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74$$FastClassBySpringCGLIB$$46f501c9.invoke(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    at org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$$EnhancerBySpringCGLIB$$526dbd74.routeLocator(<generated>) ~[spring-cloud-netflix-core-1.1.0.M3.jar:1.1.0.M3]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.3.RELEASE.jar:4.2.3.RELEASE]
    ... 70 common frames omitted

Looks like when we add the EnableZuulProxy annotation, the method zookeeperLifecycle is never called in ZookeeperDiscoveryClientConfiguration. If I remove the EnableZuulProxy, the method is called.

Remove zookeeperDiscovery from health

As we discussed last week, would it be possible to remove "zookeeperDiscovery" from health indicator?
It can become quite heavy when a lot of services are deployed and health should be fast.
It should be provided as an other endpoint if not already.

when post endpoint "/refresh", throw this exception: Background exception was not retry-able or retry gave up

20160322.18:00:48.769 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration [PropertySourceBootstrapConfiguration.java:93] - Located property source: CompositePropertySource [name='zookeeper', propertySources=[ZookeeperTreeCachePropertySource [...]]]
20160322.18:00:48.774 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.boot.SpringApplication [SpringApplication.java:670] - The following profiles are active: dev
20160322.18:00:48.781 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.context.annotation.AnnotationConfigApplicationContext [AbstractApplicationContext.java:578] - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@189535cf: startup date [Tue Mar 22 18:00:48 CST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@a971ff6
20160322.18:00:48.821 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor [AutowiredAnnotationBeanPostProcessor.java:153] - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
20160322.18:00:48.868 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.boot.SpringApplication [StartupInfoLogger.java:57] - Started application in 1.1 seconds (JVM running for 153.459)
20160322.18:00:48.869 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.context.annotation.AnnotationConfigApplicationContext [AbstractApplicationContext.java:960] - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@189535cf: startup date [Tue Mar 22 18:00:48 CST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@a971ff6
20160322.18:00:48.874 192.168.10.172 /refresh [XNIO-2 task-6]  INFO org.springframework.context.annotation.AnnotationConfigApplicationContext [AbstractApplicationContext.java:960] - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@a971ff6: startup date [Tue Mar 22 18:00:47 CST 2016]; root of context hierarchy
20160322.18:00:48.964   [XNIO-2 task-6-EventThread] ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl [CuratorFrameworkImpl.java:561] - Background exception was not retry-able or retry gave up
java.lang.IllegalStateException: instance must be started before calling this method
    at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:373)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.doRefreshData(TreeCache.java:261)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.refresh(TreeCache.java:226)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.wasCreated(TreeCache.java:280)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.processResult(TreeCache.java:411)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(CuratorFrameworkImpl.java:743)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:520)
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl$2.processResult(GetChildrenBuilderImpl.java:166)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:598)
    at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)
20160322.18:00:48.976   [XNIO-2 task-6-EventThread] ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl [CuratorFrameworkImpl.java:561] - Background exception was not retry-able or retry gave up
java.lang.IllegalStateException: instance must be started before calling this method
    at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:373)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.doRefreshData(TreeCache.java:261)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.refresh(TreeCache.java:226)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.wasCreated(TreeCache.java:280)
    at org.apache.curator.framework.recipes.cache.TreeCache$TreeNode.processResult(TreeCache.java:411)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(CuratorFrameworkImpl.java:743)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:520)
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl$2.processResult(GetChildrenBuilderImpl.java:166)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:598)
    at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)

Race Condition: Attempting to load configurations before Zookeeper is connected

I'm using spring-cloud-zookeeper to configure my spring-boot app and roughly 1 out of 10 times the framework attempts to pre-instantiate beans before Zookeeper is actually connected, causing a failure. This appears to be a race condition.

To illustrate, whenever the following log message appears before application beans are instantiated by the application context, there's no problem:

[main-EventThread] o.a.c.f.state.ConnectionStateManager     : State change: CONNECTED

However, when that message doesn't appear in the console, errors such as the following occur:

2015-09-26 21:20:45.460  WARN 89108 --- [main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
java.lang.IllegalArgumentException: Could not resolve placeholder 'readSql' in string value "${readSql}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174) ~[spring-core-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:204) ~[spring-core-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:178) ~[spring-core-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:807) ~[spring-beans-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:980) ~[spring-beans-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:967) ~[spring-beans-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:543) ~[spring-beans-4.2.1.RELEASE.jar!/:4.2.1.RELEASE]
    ... 23 common frames omitted

A workaround is to autowire a CuratorFramework member variable and block until connection is acquired. E.g.:

    @Autowired
    public void setCuratorFramework(CuratorFramework cf) {
        this.cf = cf;
        log.debug("Checking ZK connection status...");
        if (!cf.getZookeeperClient().isConnected())
            try {
                log.warn("wasn't connected so blocking for up to 3 minutes...");
                boolean connected = cf.blockUntilConnected(3, TimeUnit.MINUTES);

                if (!connected) {
                    log.warn("Couldn't connect to ZK after 3 minutes!!");
                } else {
                    log.debug("ZK Connected...sleeping for 5 seconds to allow properties to load");
                    Thread.sleep(5000);
                }
            } catch (InterruptedException ie) {
                ie.printStackTrace();
            }

    }

Of course, this isn't ideal since one has to be sure that the above code executes before any application beans are loaded.

It seems that the CuratorFramework.blockUntilConnected() method should be called internally by the framework, perhaps in ZookeeperPropertySource.start(). The race condition mentioned in the comments of that method regarding TreeCache.process() may not be resolved by blocking until connectivity is achieved but it might be made somewhat less likely to occur(?).

Trigger config refresh via ZookeeperTreeCachePropertySource.

I'd love something like:

@ZookeeperProperty(name="helpful-url",auto-start=false)
private Provider<String> helpfulUrlProvider;
...
    LOG.debug("You can find help at: {}", helpfulUrlProvider.get());

Since it's a Provider, calls to .get would automatically have the "latest" value from ZK via the ZookeeperTreeCachePropertySource. The property would automatically be expected to live under one of the contexts. auto-start false would indicate that all wiring and looking up would be performed on the first query instead of bean wiring time.

@EphemeralNode(name="helpful-url",auto-start=false,default-value="http://localhost:${server.port}")
private EphemeralNode helpfulUrl;
....
// maybe after leader election
ephemeralNode.start();
ephemeralNode.set("update value");

EphemeralNode would be lifecycle aware and close on predestroy, and if auto-start=true, call start() during post create.

Move Dependency functionality to other projects

  • *Rule*, *Ribbon*, *LoadBalancer* and *Feign* to spring-cloud-netflix
  • *ZookeeperDependenc* to spring-cloud-commons minus Zookeeper
  • move watcher package to spring-cloud-commons, DefaultDependencyWatcher -> ZookeeperDependencyWatcher
  • watcher.presence has curator classes as part of the interface, so initial this won't move.

Brixton.M1 ClassNotFoundException: org.apache.curator.framework.recipes.cache.TreeCacheListener

When creating an app from http://start.spring.io and choosing Zookeeper Discovery.

java.lang.ClassNotFoundException: org.apache.curator.framework.recipes.cache.TreeCacheListener
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_05]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_05]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_05]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_05]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_05]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_05]
    ... 45 common frames omitted
Wrapped by: java.lang.NoClassDefFoundError: org/apache/curator/framework/recipes/cache/TreeCacheListener
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_05]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_05]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_05]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) ~[na:1.8.0_05]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_05]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:367) ~[na:1.8.0_05]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_05]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_05]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_05]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_05]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_05]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_05]
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_05]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) ~[na:1.8.0_05]
    at java.lang.Class.getDeclaredMethods(Class.java:1962) ~[na:1.8.0_05]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606) ~[spring-core-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518) ~[spring-core-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504) ~[spring-core-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanTypeForBeanMethod(OnBeanCondition.java:325) [spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.addDeducedBeanType(OnBeanCondition.java:312) [spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:267) [spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:110) [spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45) [spring-boot-autoconfigure-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:333) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:673) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:519) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:667) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:342) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:273) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:980) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:969) [spring-boot-1.3.0.M5.jar:1.3.0.M5]
    at zkdemo.ZkdemoApplication.main(ZkdemoApplication.java:20) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_05]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_05]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_05]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_05]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.3.0.M5.jar:1.3.0.M5]

Can not build project from the sources

Local Zookeeper instance is running with default settings, but discovery tests are failed.

Executed: mvn --settings .settings.xml package

Result:
Tests run: 39, Failures: 0, Errors: 21, Skipped: 1

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] spring-cloud-zookeeper-dependencies ................ SUCCESS [ 0.002 s]
[INFO] Spring Cloud Zookeeper ............................. SUCCESS [ 1.785 s]
[INFO] Spring Cloud Zookeeper Core ........................ SUCCESS [ 5.670 s]
[INFO] Spring Cloud Zookeeper Config ...................... SUCCESS [ 8.787 s]
[INFO] Spring Cloud Zookeeper Discovery ................... FAILURE [ 3.618 s]
[INFO] Spring Cloud Starter Zookeeper ..................... SKIPPED
[INFO] Spring Cloud Starter Zookeeper Config .............. SKIPPED
[INFO] Spring Cloud Starter Zookeeper Discovery ........... SKIPPED
[INFO] Spring Cloud Starter Zookeeper All ................. SKIPPED
[INFO] Spring Cloud Zookeeper Sample ...................... SKIPPED
[INFO] Spring Cloud Zookeeper Docs ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.559 s
[INFO] Finished at: 2016-04-30T10:29:05+03:00
[INFO] Final Memory: 61M/425M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.6:test (default-test) on project spring-cloud-zookeeper-discovery: There are test failures.
[ERROR]

ZookeeperDiscoveryHealthIndicator fails on nested structure

Given the following Zookeeper structure:

└── folder1
    ├── serviceA
    ├── serviceB
    └── folder2
        ├── serviceC
        └── serviceD

If via Ribbon anybody will try to call serviceA or serviceB one will fail cause their health for ZookeeperDiscovery will look like this

zookeeperDiscovery: {
status: "DOWN",
error: "java.io.EOFException: No content to map to Object due to end of input"
},

That's because

@Override
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        try {
            Collection<String> names = getNamesToQuery();
            ArrayList<ServiceInstance<ZookeeperInstance>> allInstances = new ArrayList<>();
            for (String name : names) {
                Collection<ServiceInstance<ZookeeperInstance>> instances = this.serviceDiscovery
                        .getServiceDiscovery().queryForInstances(name);
                for (ServiceInstance<ZookeeperInstance> instance : instances) {
                    allInstances.add(instance);
                }
            }
            builder.up().withDetail("services", allInstances);
        }
        catch (Exception e) {
            log.error("Error", e);
            builder.down(e);
        }
    }

Line Collection<ServiceInstance<ZookeeperInstance>> instances = this.serviceDiscovery .getServiceDiscovery().queryForInstances(name); fails to properly parse the contents of the folder folder2 which is on the same level as the serviceA and serviceB.

We would have to check if an entry is a folder and either ignore parsing issues or continue down that path.

Discovery does not recognise new instances or removed instances

Hi all,

I'm starting to use Zookeeper for service discovery with Spring Cloud. I created a simple application to demonstrate my issue. My client does not recognise when new instances are available or, even worse, when an instance is not available. The code for this example is https://github.com/sigrist/zookeeper-sandbox

I created a simple HTTP service that sends a Hello. I build a client service that uses this 'Hello Service'. If I started 2 or more services before the client, I can see that the load balancer works as expected, calling all the available instances. But if I shutdown one of the servers, the client still tries to connect to it, failing and showing the Default value for a failed request (using Netflix Hystrix).

If I started new server instances, the client does not recognise then, using only the available at boot time.

When I started new servers, I can see in the Client log that a new instance is available, but the server list is not updated:

2015-11-02 12:36:36.314  INFO 35764 --- [-ServiceCache-0] .w.DependencyStateChangeListenerRegistry : Service cache state change for '/zookeeper-sandbox' instances, current service state: CONNECTED

Also, when I shutdown one server instance, a log in the client shows a new event:

2015-11-02 12:37:29.646  INFO 35764 --- [-ServiceCache-0] .w.DependencyStateChangeListenerRegistry : Service cache state change for '/zookeeper-sandbox' instances, current service state: CONNECTED

My question is, how to update the server list in the client? Is there some configuration that I'm missing?

Thanks
Sigrist

Fix Zookeeper javadocs

[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/dependency/StickyRule.java:37: warning - Tag @link: reference not found: org.apache.curator.x.discovery.strategies.StickyStrategy
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:24: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:24: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:32: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:32: warning - Tag @see: reference not found: ZookeeperDependencies
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:24: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:24: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.
[WARNING] /home/travis/build/spring-cloud/spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/watcher/DependencyWatcherListener.java:24: warning - Tag @see cannot be used in inline documentation.  It can only be used in the following types of documentation: overview, package, class/interface, constructor, field, method.

Problem while starting the Application with @EnableDiscoveryClient annotation

java.lang.IllegalStateException: Error processing condition on org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClientConfiguration.zookeeperServiceDiscovery
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64) ~[spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:333) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at com.panbet.api.ext.oauth2.OAuth2Application.main(OAuth2Application.java:50) [classes/:na]
Caused by: java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)
    at org.springframework.util.Assert.isTrue(Assert.java:68) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.validate(OnBeanCondition.java:279) ~[spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:275) ~[spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:111) ~[spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
    ... 17 common frames omitted

microservice without dependencies

ZookeeperDependenciesAutoConfiguration is there to initialise missing ZookeeperDependencies bean for microservice without dependencies.
BUT, @ConditionalOnDependenciesPassed enables this configuration only when dependencies are specified.
see DependenciesPassedCondition
There's also some logic with spring.cloud.zookeeper.dependencies.enabled property, but whenever you pass this property, dependency with path "enabled" is on the list of dependencies :). Stubrunner is trying to download stubs for it.

100% cpu while running sample

The sample in https://github.com/spring-cloud/spring-cloud-zookeeper/tree/master/spring-cloud-zookeeper-sample is using 100% both in the java client and in the zookeeper server (That makes it 200% cpu).
I found that it is because the sample does not provide any configuration in zookeeper. At least, I have noticed the following type of behaviour when logging is in debug in zookeeper org.apache.zookeeper.ClientCnxn class.

12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75689,3  replyHeader:: 75689,87,-101  request:: '/config/application,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75690,3  replyHeader:: 75690,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75691,3  replyHeader:: 75691,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75692,3  replyHeader:: 75692,87,-101  request:: '/config/application,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75693,3  replyHeader:: 75693,87,-101  request:: '/config/application,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75694,3  replyHeader:: 75694,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75695,3  replyHeader:: 75695,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75696,3  replyHeader:: 75696,87,-101  request:: '/config/application,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75697,3  replyHeader:: 75697,87,-101  request:: '/config/application,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75698,3  replyHeader:: 75698,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.046 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75699,3  replyHeader:: 75699,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75700,3  replyHeader:: 75700,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75701,3  replyHeader:: 75701,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75702,3  replyHeader:: 75702,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75703,3  replyHeader:: 75703,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75704,3  replyHeader:: 75704,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75705,3  replyHeader:: 75705,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75706,3  replyHeader:: 75706,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75707,3  replyHeader:: 75707,87,-101  request:: '/config/testZookeeperApp,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75708,3  replyHeader:: 75708,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/application serverPath:/config/application finished:false header:: 75709,3  replyHeader:: 75709,87,-101  request:: '/config/application,T  response::  
12:35:03.047 [main-SendThread(localhost:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x15013475773000c, packet:: clientPath:/config/testZookeeperApp serverPath:/config/testZookeeperApp finished:false header:: 75710,3  replyHeader:: 75710,87,-101  request:: '/config/testZookeeperApp,T  response::  

If I remove the dependency to Maven: org.springframework.cloud:spring-cloud-starter-zookeeper-config:1.0.0.BUILD-SNAPSHOT by changing spring-cloud-starter-zookeeper-all to only spring-cloud-starter-zookeeper-discovery, then everything seems fine.

DependencyRestTemplateAutoConfiguration can't find @LoadBalanced RestTemplate

DependencyRestTemplateAutoConfiguration has
@Autowired @LoadBalanced RestTemplate restTemplate;
But, LoadBalancerAutoConfiguration no longer creates it as of 1.1.0.RC3
It did in 1.1.0.M3
So we get the exception when loading context

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.zookeeper.discovery.dependency.DependencyRestTemplateAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.web.client.RestTemplate org.springframework.cloud.zookeeper.discovery.dependency.DependencyRestTemplateAutoConfiguration.restTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.cloud.client.loadbalancer.LoadBalanced()}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at com.ofg.twitter.Application.main(Application.groovy:21)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.web.client.RestTemplate org.springframework.cloud.zookeeper.discovery.dependency.DependencyRestTemplateAutoConfiguration.restTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.cloud.client.loadbalancer.LoadBalanced()}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 19 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.cloud.client.loadbalancer.LoadBalanced()}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
    ... 21 common frames omitted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.