Merge pull request #71 from cameleeck/issues/70-renamed_some_properties
[#70] - Renaming some of properties
This commit is contained in:
@@ -96,7 +96,7 @@ You can also benefit from the Zookeeper Dependency Watchers functionality that l
|
||||
=== How to activate Zookeeper Dependencies
|
||||
|
||||
- Including a dependency on `org.springframework.cloud:spring-cloud-starter-zookeeper-discovery` will enable auto-configuration that will setup Spring Cloud Zookeeper Dependencies.
|
||||
- In addition to that you have to set the property `spring.cloud.zookeeper.dependencies.enabled` to true (defaults to `true` if not set explicitly).
|
||||
- In addition to that you have to set the property `spring.cloud.zookeeper.dependency.enabled` to true (defaults to `true` if not set explicitly).
|
||||
- You have to have the `spring.cloud.zookeeper.dependencies` section properly set up - check the subsequent section for more details.
|
||||
|
||||
=== Setting up Zookeeper Dependencies
|
||||
@@ -245,14 +245,14 @@ since `stubs` is the default classifier.
|
||||
There is a bunch of properties that you can set to enable / disable parts of Zookeeper Dependencies functionalities.
|
||||
|
||||
- `spring.cloud.zookeeper.dependencies` - if you don't set this property you won't benefit from Zookeeper Dependencies
|
||||
- `spring.cloud.zookeeper.dependencies.ribbon.enabled` (enabled by default) - Ribbon requires explicit global configuration or a particular one for a dependency. By turning on this property
|
||||
- `spring.cloud.zookeeper.dependency.ribbon.enabled` (enabled by default) - Ribbon requires explicit global configuration or a particular one for a dependency. By turning on this property
|
||||
runtime load balancing strategy resolution is possible and you can profit from the `loadBalancerType` section of the Zookeeper Dependencies. The configuration that needs this property
|
||||
has an implementation of `LoadBalancerClient` that delegates to the `ILoadBalancer` presented in the next bullet
|
||||
- `spring.cloud.zookeeper.dependencies.ribbon.loadbalancer` (enabled by default) - thanks to this property the custom `ILoadBalancer` knows that the part of the URI passed to Ribbon might
|
||||
- `spring.cloud.zookeeper.dependency.ribbon.loadbalancer` (enabled by default) - thanks to this property the custom `ILoadBalancer` knows that the part of the URI passed to Ribbon might
|
||||
actually be the alias that has to be resolved to a proper path in Zookeeper. Without this property you won't be able to register applications under nested paths.
|
||||
- `spring.cloud.zookeeper.dependencies.headers.enabled` (enabled by default) - this property registers such a `RibbonClient` that automatically will append appropriate headers and content
|
||||
- `spring.cloud.zookeeper.dependency.headers.enabled` (enabled by default) - this property registers such a `RibbonClient` that automatically will append appropriate headers and content
|
||||
types with version as presented in the Dependency configuration. Without this setting of those two parameters will not be operational.
|
||||
- `spring.cloud.zookeeper.dependencies.resttemplate.enabled` (enabled by default) - when enabled will modify the request headers of `@LoadBalanced` annotated `RestTemplate` so that it passes
|
||||
- `spring.cloud.zookeeper.dependency.resttemplate.enabled` (enabled by default) - when enabled will modify the request headers of `@LoadBalanced` annotated `RestTemplate` so that it passes
|
||||
headers and content type with version set in Dependency configuration. Wihtout this setting of those two parameters will not be operational.
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ZookeeperRibbonClientConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnDependenciesPassed
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependencies.ribbon.loadbalancer", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependency.ribbon.loadbalancer", matchIfMissing = true)
|
||||
public ILoadBalancer dependenciesBasedLoadBalancer(ZookeeperDependencies zookeeperDependencies,
|
||||
ServerList<?> serverList, IClientConfig config, IPing iPing) {
|
||||
return new DependenciesBasedLoadBalancer(zookeeperDependencies, serverList, config, iPing);
|
||||
|
||||
@@ -33,6 +33,6 @@ import org.springframework.context.annotation.Conditional;
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Conditional(DependenciesPassedCondition.class)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependencies.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependency.enabled", matchIfMissing = true)
|
||||
public @interface ConditionalOnDependenciesPassed {
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DependenciesNotPassedCondition extends DependenciesPassedCondition
|
||||
return ConditionOutcome.inverse(propertiesSet);
|
||||
}
|
||||
Boolean dependenciesEnabled = context.getEnvironment()
|
||||
.getProperty("spring.cloud.zookeeper.dependencies.enabled", Boolean.class, false);
|
||||
.getProperty("spring.cloud.zookeeper.dependency.enabled", Boolean.class, false);
|
||||
if (dependenciesEnabled) {
|
||||
return ConditionOutcome.noMatch("Dependencies are defined in configuration and switch is turned on");
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import feign.Response;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnDependenciesPassed
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependencies.headers.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependency.headers.enabled", matchIfMissing = true)
|
||||
@ConditionalOnClass({ Client.class, LoadBalancerFeignClient.class })
|
||||
@AutoConfigureAfter({ RibbonAutoConfiguration.class, FeignRibbonClientAutoConfiguration.class })
|
||||
public class DependencyFeignClientAutoConfiguration {
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
@ConditionalOnRibbonZookeeper
|
||||
@Configuration
|
||||
@ConditionalOnDependenciesPassed
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependencies.resttemplate.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependency.resttemplate.enabled", matchIfMissing = true)
|
||||
public class DependencyRestTemplateAutoConfiguration {
|
||||
|
||||
@Autowired @LoadBalanced RestTemplate restTemplate;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DependencyRibbonAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependencies.ribbon.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.zookeeper.dependency.ribbon.enabled", matchIfMissing = true)
|
||||
public LoadBalancerClient loadBalancerClient(SpringClientFactory springClientFactory) {
|
||||
return new RibbonLoadBalancerClient(springClientFactory) {
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ZookeeperDependencies {
|
||||
/**
|
||||
* Default health endpoint that will be checked to verify that a dependency is alive
|
||||
*/
|
||||
@Value("${spring.cloud.zookeeper.dependencies.ribbon.loadbalancer.defaulthealthendpoint:/health}")
|
||||
@Value("${spring.cloud.zookeeper.dependency.ribbon.loadbalancer.defaulthealthendpoint:/health}")
|
||||
private String defaultHealthEndpoint;
|
||||
|
||||
@PostConstruct
|
||||
|
||||
@@ -56,7 +56,7 @@ class StickyRuleISpec extends Specification implements PollingUtils {
|
||||
@RestoreSystemProperties
|
||||
def 'should use sticky load balancing strategy taken from Zookeeper dependencies'() {
|
||||
given:
|
||||
System.setProperty('spring.cloud.zookeeper.dependencies.ribbon.loadbalancer.checkping', 'false')
|
||||
System.setProperty('spring.cloud.zookeeper.dependency.ribbon.loadbalancer.checkping', 'false')
|
||||
expect:
|
||||
thereAreTwoRegisteredServices()
|
||||
URI uri = getUriForAlias()
|
||||
|
||||
Reference in New Issue
Block a user