From 50e2d5a7f0f0ff360f82e46d7fbbebecd1473ca2 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Tue, 9 Jan 2018 13:27:23 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- multi/multi_spring-cloud-ribbon.html | 49 +------------------------- single/spring-cloud-netflix.html | 49 +------------------------- spring-cloud-netflix.xml | 51 ++-------------------------- 3 files changed, 4 insertions(+), 145 deletions(-) diff --git a/multi/multi_spring-cloud-ribbon.html b/multi/multi_spring-cloud-ribbon.html index 64a08e563..78e9d4638 100644 --- a/multi/multi_spring-cloud-ribbon.html +++ b/multi/multi_spring-cloud-ribbon.html @@ -32,54 +32,7 @@ separate, non-overlapping package, or specify the packages to scan explicitly in the @ComponentScan).

Spring Cloud Netflix provides the following beans by default for ribbon (BeanType beanName: ClassName):

Creating a bean of one of those type and placing it in a @RibbonClient configuration (such as FooConfiguration above) allows you to override each -one of the beans described. Example:

@Configuration
-protected static class FooConfiguration {
-	@Bean
-	public ZonePreferenceServerListFilter serverListFilter() {
-		ZonePreferenceServerListFilter filter = new ZonePreferenceServerListFilter();
-		filter.setZone("myTestZone");
-		return filter;
-	}
-
-	@Bean
-	public IPing ribbonPing() {
-		return new PingUrl();
-	}
-}

This replaces the NoOpPing with PingUrl and provides a custom serverListFilter

6.3 Customizing default for all Ribbon Clients

A default configuration can be provided for all Ribbon Clients using the @RibbonClients annotation and registering a default configuration as shown in the following example:

@RibbonClients(defaultConfiguration = DefaultRibbonConfig.class)
-public class RibbonClientDefaultConfigurationTestsConfig {
-
-	public static class BazServiceList extends ConfigurationBasedServerList {
-		public BazServiceList(IClientConfig config) {
-			super.initWithNiwsConfig(config);
-		}
-	}
-}
-
-@Configuration
-class DefaultRibbonConfig {
-
-	@Bean
-	public IRule ribbonRule() {
-		return new BestAvailableRule();
-	}
-
-	@Bean
-	public IPing ribbonPing() {
-		return new PingUrl();
-	}
-
-	@Bean
-	public ServerList<Server> ribbonServerList(IClientConfig config) {
-		return new RibbonClientDefaultConfigurationTestsConfig.BazServiceList(config);
-	}
-
-	@Bean
-	public ServerListSubsetFilter serverListFilter() {
-		ServerListSubsetFilter filter = new ServerListSubsetFilter();
-		return filter;
-	}
-
-}

6.4 Customizing the Ribbon Client using properties

Starting with version 1.2.0, Spring Cloud Netflix now supports customizing Ribbon clients using properties to be compatible with the Ribbon documentation.

This allows you to change behavior at start up time in different environments.

The supported properties are listed below and should be prefixed by <clientName>.ribbon.:

  • NFLoadBalancerClassName: should implement ILoadBalancer
  • NFLoadBalancerRuleClassName: should implement IRule
  • NFLoadBalancerPingClassName: should implement IPing
  • NIWSServerListClassName: should implement ServerList
  • NIWSServerListFilterClassName should implement ServerListFilter
[Note]Note

Classes defined in these properties have precedence over beans defined using @RibbonClient(configuration=MyRibbonConfig.class) and the defaults provided by Spring Cloud Netflix.

To set the IRule for a service name users you could set the following:

application.yml.  +one of the beans described. Example:

Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientsPreprocessorIntegrationTests.java[tags=sample_override_ribbon_config,indent=0]

This replaces the NoOpPing with PingUrl and provides a custom serverListFilter

6.3 Customizing default for all Ribbon Clients

A default configuration can be provided for all Ribbon Clients using the @RibbonClients annotation and registering a default configuration as shown in the following example:

Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/test/RibbonClientDefaultConfigurationTestsConfig.java[tags=sample_default_ribbon_config,indent=0]

6.4 Customizing the Ribbon Client using properties

Starting with version 1.2.0, Spring Cloud Netflix now supports customizing Ribbon clients using properties to be compatible with the Ribbon documentation.

This allows you to change behavior at start up time in different environments.

The supported properties are listed below and should be prefixed by <clientName>.ribbon.:

  • NFLoadBalancerClassName: should implement ILoadBalancer
  • NFLoadBalancerRuleClassName: should implement IRule
  • NFLoadBalancerPingClassName: should implement IPing
  • NIWSServerListClassName: should implement ServerList
  • NIWSServerListFilterClassName should implement ServerListFilter
[Note]Note

Classes defined in these properties have precedence over beans defined using @RibbonClient(configuration=MyRibbonConfig.class) and the defaults provided by Spring Cloud Netflix.

To set the IRule for a service name users you could set the following:

application.yml. 

users:
   ribbon:
     NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
diff --git a/single/spring-cloud-netflix.html b/single/spring-cloud-netflix.html
index d001c0386..cdfc17cfa 100644
--- a/single/spring-cloud-netflix.html
+++ b/single/spring-cloud-netflix.html
@@ -386,54 +386,7 @@ separate, non-overlapping package, or specify the packages to scan
 explicitly in the @ComponentScan).

Spring Cloud Netflix provides the following beans by default for ribbon (BeanType beanName: ClassName):

Creating a bean of one of those type and placing it in a @RibbonClient configuration (such as FooConfiguration above) allows you to override each -one of the beans described. Example:

@Configuration
-protected static class FooConfiguration {
-	@Bean
-	public ZonePreferenceServerListFilter serverListFilter() {
-		ZonePreferenceServerListFilter filter = new ZonePreferenceServerListFilter();
-		filter.setZone("myTestZone");
-		return filter;
-	}
-
-	@Bean
-	public IPing ribbonPing() {
-		return new PingUrl();
-	}
-}

This replaces the NoOpPing with PingUrl and provides a custom serverListFilter

6.3 Customizing default for all Ribbon Clients

A default configuration can be provided for all Ribbon Clients using the @RibbonClients annotation and registering a default configuration as shown in the following example:

@RibbonClients(defaultConfiguration = DefaultRibbonConfig.class)
-public class RibbonClientDefaultConfigurationTestsConfig {
-
-	public static class BazServiceList extends ConfigurationBasedServerList {
-		public BazServiceList(IClientConfig config) {
-			super.initWithNiwsConfig(config);
-		}
-	}
-}
-
-@Configuration
-class DefaultRibbonConfig {
-
-	@Bean
-	public IRule ribbonRule() {
-		return new BestAvailableRule();
-	}
-
-	@Bean
-	public IPing ribbonPing() {
-		return new PingUrl();
-	}
-
-	@Bean
-	public ServerList<Server> ribbonServerList(IClientConfig config) {
-		return new RibbonClientDefaultConfigurationTestsConfig.BazServiceList(config);
-	}
-
-	@Bean
-	public ServerListSubsetFilter serverListFilter() {
-		ServerListSubsetFilter filter = new ServerListSubsetFilter();
-		return filter;
-	}
-
-}

6.4 Customizing the Ribbon Client using properties

Starting with version 1.2.0, Spring Cloud Netflix now supports customizing Ribbon clients using properties to be compatible with the Ribbon documentation.

This allows you to change behavior at start up time in different environments.

The supported properties are listed below and should be prefixed by <clientName>.ribbon.:

  • NFLoadBalancerClassName: should implement ILoadBalancer
  • NFLoadBalancerRuleClassName: should implement IRule
  • NFLoadBalancerPingClassName: should implement IPing
  • NIWSServerListClassName: should implement ServerList
  • NIWSServerListFilterClassName should implement ServerListFilter
[Note]Note

Classes defined in these properties have precedence over beans defined using @RibbonClient(configuration=MyRibbonConfig.class) and the defaults provided by Spring Cloud Netflix.

To set the IRule for a service name users you could set the following:

application.yml.  +one of the beans described. Example:

Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientsPreprocessorIntegrationTests.java[tags=sample_override_ribbon_config,indent=0]

This replaces the NoOpPing with PingUrl and provides a custom serverListFilter

6.3 Customizing default for all Ribbon Clients

A default configuration can be provided for all Ribbon Clients using the @RibbonClients annotation and registering a default configuration as shown in the following example:

Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/test/RibbonClientDefaultConfigurationTestsConfig.java[tags=sample_default_ribbon_config,indent=0]

6.4 Customizing the Ribbon Client using properties

Starting with version 1.2.0, Spring Cloud Netflix now supports customizing Ribbon clients using properties to be compatible with the Ribbon documentation.

This allows you to change behavior at start up time in different environments.

The supported properties are listed below and should be prefixed by <clientName>.ribbon.:

  • NFLoadBalancerClassName: should implement ILoadBalancer
  • NFLoadBalancerRuleClassName: should implement IRule
  • NFLoadBalancerPingClassName: should implement IPing
  • NIWSServerListClassName: should implement ServerList
  • NIWSServerListFilterClassName should implement ServerListFilter
[Note]Note

Classes defined in these properties have precedence over beans defined using @RibbonClient(configuration=MyRibbonConfig.class) and the defaults provided by Spring Cloud Netflix.

To set the IRule for a service name users you could set the following:

application.yml. 

users:
   ribbon:
     NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
diff --git a/spring-cloud-netflix.xml b/spring-cloud-netflix.xml
index e0de5e60a..b1e7d1614 100644
--- a/spring-cloud-netflix.xml
+++ b/spring-cloud-netflix.xml
@@ -719,60 +719,13 @@ explicitly in the @ComponentScan).
 Creating a bean of one of those type and placing it in a @RibbonClient
 configuration (such as FooConfiguration above) allows you to override each
 one of the beans described.  Example:
-@Configuration
-protected static class FooConfiguration {
-	@Bean
-	public ZonePreferenceServerListFilter serverListFilter() {
-		ZonePreferenceServerListFilter filter = new ZonePreferenceServerListFilter();
-		filter.setZone("myTestZone");
-		return filter;
-	}
-
-	@Bean
-	public IPing ribbonPing() {
-		return new PingUrl();
-	}
-}
+Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientsPreprocessorIntegrationTests.java[tags=sample_override_ribbon_config,indent=0]
 This replaces the NoOpPing with PingUrl and provides a custom serverListFilter
 
 
Customizing default for all Ribbon Clients A default configuration can be provided for all Ribbon Clients using the @RibbonClients annotation and registering a default configuration as shown in the following example: -@RibbonClients(defaultConfiguration = DefaultRibbonConfig.class) -public class RibbonClientDefaultConfigurationTestsConfig { - - public static class BazServiceList extends ConfigurationBasedServerList { - public BazServiceList(IClientConfig config) { - super.initWithNiwsConfig(config); - } - } -} - -@Configuration -class DefaultRibbonConfig { - - @Bean - public IRule ribbonRule() { - return new BestAvailableRule(); - } - - @Bean - public IPing ribbonPing() { - return new PingUrl(); - } - - @Bean - public ServerList<Server> ribbonServerList(IClientConfig config) { - return new RibbonClientDefaultConfigurationTestsConfig.BazServiceList(config); - } - - @Bean - public ServerListSubsetFilter serverListFilter() { - ServerListSubsetFilter filter = new ServerListSubsetFilter(); - return filter; - } - -} +Unresolved directive in spring-cloud-netflix.adoc - include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/test/RibbonClientDefaultConfigurationTestsConfig.java[tags=sample_default_ribbon_config,indent=0]
Customizing the Ribbon Client using properties