diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java index 7b45645056..c9cfd6c26e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticProperties.java @@ -29,9 +29,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class ElasticProperties extends StepRegistryProperties { /** - * Hosts to export metrics to. + * Host to export metrics to. */ - private String[] hosts = new String[] { "http://localhost:9200" }; + private String host = "http://localhost:9200"; /** * Index to export metrics to. @@ -64,12 +64,12 @@ public class ElasticProperties extends StepRegistryProperties { */ private String password = ""; - public String[] getHosts() { - return this.hosts; + public String getHost() { + return this.host; } - public void setHosts(String[] hosts) { - this.hosts = hosts; + public void setHost(String host) { + this.host = host; } public String getIndex() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java index fe6e7055a4..d4098fa06b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapter.java @@ -33,8 +33,8 @@ class ElasticPropertiesConfigAdapter extends } @Override - public String[] hosts() { - return get(ElasticProperties::getHosts, ElasticConfig.super::hosts); + public String host() { + return get(ElasticProperties::getHost, ElasticConfig.super::host); } @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java index fd7ee091be..3c37dca44f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesConfigAdapterTests.java @@ -30,9 +30,9 @@ public class ElasticPropertiesConfigAdapterTests { @Test public void whenPropertiesHostsIsSetAdapterHostsReturnsIt() { ElasticProperties properties = new ElasticProperties(); - properties.setHosts(new String[] { "https://elastic.example.com" }); - assertThat(new ElasticPropertiesConfigAdapter(properties).hosts()) - .isEqualTo(new String[] { "https://elastic.example.com" }); + properties.setHost("https://elastic.example.com"); + assertThat(new ElasticPropertiesConfigAdapter(properties).host()) + .isEqualTo("https://elastic.example.com"); } @Test diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesTests.java index aaa2e874f1..c83308e4c5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticPropertiesTests.java @@ -34,7 +34,7 @@ public class ElasticPropertiesTests extends StepRegistryPropertiesTests { ElasticProperties properties = new ElasticProperties(); ElasticConfig config = ElasticConfig.DEFAULT; assertStepRegistryDefaultValues(properties, config); - assertThat(properties.getHosts()).isEqualTo(config.hosts()); + assertThat(properties.getHost()).isEqualTo(config.host()); assertThat(properties.getIndex()).isEqualTo(config.index()); assertThat(properties.getIndexDateFormat()).isEqualTo(config.indexDateFormat()); assertThat(properties.getPassword()).isEqualTo(config.password()); diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 0fbd8547be..e638bc3967 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1422,7 +1422,7 @@ content into your application. Rather, pick only the properties that you need. management.metrics.export.elastic.batch-size=10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made. management.metrics.export.elastic.connect-timeout=1s # Connection timeout for requests to this backend. management.metrics.export.elastic.enabled=true # Whether exporting of metrics to this backend is enabled. - management.metrics.export.elastic.hosts=http://localhost:9200 # Hosts to export metrics to. + management.metrics.export.elastic.host=http://localhost:9200 # Host to export metrics to. management.metrics.export.elastic.index=metrics # Index to export metrics to. management.metrics.export.elastic.index-date-format=yyyy-MM # Index date format used for rolling indices. Appended to the index name, preceded by a '-'. management.metrics.export.elastic.num-threads=2 # Number of threads to use with the metrics publishing scheduler. diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index b05de13fcc..afcb034fe3 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -1490,7 +1490,7 @@ using the following property: [source,properties,indent=0] ---- - management.metrics.export.elastic.hosts=http://elastic.example.com:8086 + management.metrics.export.elastic.host=http://elastic.example.com:8086 ----