Adds spring.cloud.consul.discovery.enabled guard to ribbon.
Fixes gh-642 Fixes gh-583
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
|
||||
|spring.cloud.consul.config.acl-token | |
|
||||
|spring.cloud.consul.config.data-key | `data` | If format is Format.PROPERTIES or Format.YAML then the following field is used as key to look up consul for configuration.
|
||||
|spring.cloud.consul.config.default-context | `application` |
|
||||
|spring.cloud.consul.config.enabled | `true` |
|
||||
|spring.cloud.consul.config.default-context | `application` |
|
||||
|spring.cloud.consul.config.enabled | `true` |
|
||||
|spring.cloud.consul.config.fail-fast | `true` | Throw exceptions during config lookup if true, otherwise, log warnings.
|
||||
|spring.cloud.consul.config.format | |
|
||||
|spring.cloud.consul.config.name | | Alternative to spring.application.name to use in looking up values in consul KV.
|
||||
|spring.cloud.consul.config.prefix | |
|
||||
|spring.cloud.consul.config.prefixes | |
|
||||
|spring.cloud.consul.config.profile-separator | `,` |
|
||||
|spring.cloud.consul.config.prefix | |
|
||||
|spring.cloud.consul.config.prefixes | |
|
||||
|spring.cloud.consul.config.profile-separator | `,` |
|
||||
|spring.cloud.consul.config.watch.delay | `1000` | The value of the fixed delay for the watch in millis. Defaults to 1000.
|
||||
|spring.cloud.consul.config.watch.enabled | `true` | If the watch is enabled. Defaults to true.
|
||||
|spring.cloud.consul.config.watch.wait-time | `55` | The number of seconds to wait (or block) for watch query, defaults to 55. Needs to be less than default ConsulClient (defaults to 60). To increase ConsulClient timeout create a ConsulClient bean with a custom ConsulRawClient with a custom HttpClient.
|
||||
@@ -32,17 +32,17 @@
|
||||
|spring.cloud.consul.discovery.health-check-timeout | | Timeout for health check (e.g. 10s).
|
||||
|spring.cloud.consul.discovery.health-check-tls-skip-verify | | Skips certificate verification during service checks if true, otherwise runs certificate verification.
|
||||
|spring.cloud.consul.discovery.health-check-url | | Custom health check url to override default.
|
||||
|spring.cloud.consul.discovery.heartbeat.enabled | `false` |
|
||||
|spring.cloud.consul.discovery.heartbeat.enabled | `false` |
|
||||
|spring.cloud.consul.discovery.heartbeat.interval-ratio | |
|
||||
|spring.cloud.consul.discovery.heartbeat.reregister-service-on-failure | `false` |
|
||||
|spring.cloud.consul.discovery.heartbeat.ttl | `30s` |
|
||||
|spring.cloud.consul.discovery.heartbeat.reregister-service-on-failure | `false` |
|
||||
|spring.cloud.consul.discovery.heartbeat.ttl | `30s` |
|
||||
|spring.cloud.consul.discovery.hostname | | Hostname to use when accessing server.
|
||||
|spring.cloud.consul.discovery.include-hostname-in-instance-id | `false` | Whether hostname is included into the default instance id when registering service.
|
||||
|spring.cloud.consul.discovery.instance-group | | Service instance group.
|
||||
|spring.cloud.consul.discovery.instance-id | | Unique service instance id.
|
||||
|spring.cloud.consul.discovery.instance-zone | | Service instance zone.
|
||||
|spring.cloud.consul.discovery.ip-address | | IP address to use when accessing service (must also set preferIpAddress to use).
|
||||
|spring.cloud.consul.discovery.lifecycle.enabled | `true` |
|
||||
|spring.cloud.consul.discovery.lifecycle.enabled | `true` |
|
||||
|spring.cloud.consul.discovery.management-enable-tag-override | | Enable tag override for the registered management service.
|
||||
|spring.cloud.consul.discovery.management-metadata | | Metadata to use when registering management service.
|
||||
|spring.cloud.consul.discovery.management-port | | Port to register the management service under (defaults to management port).
|
||||
@@ -78,4 +78,5 @@
|
||||
|spring.cloud.consul.tls.key-store-password | | Password to an external keystore.
|
||||
|spring.cloud.consul.tls.key-store-path | | Path to an external keystore.
|
||||
|
||||
|===
|
||||
|===
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.cloud.consul.ribbon.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Enables Consul and Ribbon integration.",
|
||||
"defaultValue": "true"
|
||||
},
|
||||
{
|
||||
"name": "spring.cloud.service-registry.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.consul.discovery;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RibbonConsulAutoConfiguration}.
|
||||
*
|
||||
* @author Flora Kalisa
|
||||
*/
|
||||
|
||||
public class RibbonConsulAutoConfigurationTests {
|
||||
|
||||
ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(RibbonAutoConfiguration.class,
|
||||
RibbonConsulAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void shouldWorkWithDefaults() {
|
||||
contextRunner.run(context -> assertThat(context)
|
||||
.hasSingleBean(RibbonConsulAutoConfiguration.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveRibbonConsulAutoConfigWhenConsulRibbonDisabled() {
|
||||
contextRunner.withPropertyValues("spring.cloud.consul.ribbon.enabled=false")
|
||||
.run(context -> assertThat(context)
|
||||
.doesNotHaveBean(RibbonConsulAutoConfiguration.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveRibbonConsulAutoConfigWhenConsulDiscoveryDisabled() {
|
||||
contextRunner.withPropertyValues("spring.cloud.consul.discovery.enabled=false")
|
||||
.run(context -> assertThat(context)
|
||||
.doesNotHaveBean(RibbonConsulAutoConfiguration.class));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user