Polish "Remove code deprecated in 2.1"

Closes gh-16013
pull/16053/head
Stephane Nicoll 6 years ago
parent 246111cd84
commit 715db153e3

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -48,23 +48,8 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
this.properties = properties;
this.mBeanServer = mBeanServer;
this.contextId = contextId;
this.uniqueNames = determineUniqueNames(environment, properties);
}
@SuppressWarnings("deprecation")
private static boolean determineUniqueNames(Environment environment,
JmxEndpointProperties properties) {
Boolean uniqueNames = environment.getProperty("spring.jmx.unique-names",
Boolean.class);
Boolean endpointUniqueNames = properties.getUniqueNames();
if (uniqueNames == null) {
return (endpointUniqueNames != null) ? endpointUniqueNames : false;
}
if (endpointUniqueNames != null & !uniqueNames.equals(endpointUniqueNames)) {
throw new IllegalArgumentException(
"Configuration mismatch, 'management.endpoints.jmx.unique-names' is deprecated, use only 'spring.jmx.unique-names'");
}
return uniqueNames;
this.uniqueNames = environment.getProperty("spring.jmx.unique-names",
Boolean.class, false);
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -21,7 +21,6 @@ import java.util.Properties;
import java.util.Set;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
@ -41,11 +40,6 @@ public class JmxEndpointProperties {
*/
private String domain = "org.springframework.boot";
/**
* Whether unique runtime object names should be ensured.
*/
private Boolean uniqueNames;
/**
* Additional static properties to append to all ObjectNames of MBeans representing
* Endpoints.
@ -71,17 +65,6 @@ public class JmxEndpointProperties {
this.domain = domain;
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "spring.jmx.unique-names")
public Boolean getUniqueNames() {
return this.uniqueNames;
}
@Deprecated
public void setUniqueNames(Boolean uniqueNames) {
this.uniqueNames = uniqueNames;
}
public Properties getStaticNames() {
return this.staticNames;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -41,7 +40,6 @@ import org.springframework.context.annotation.Configuration;
@AutoConfigureAfter(MetricsAutoConfiguration.class)
@ConditionalOnClass(MeterRegistry.class)
@ConditionalOnBean(MeterRegistry.class)
@ConditionalOnProperty(value = "management.metrics.binders.jvm.enabled", matchIfMissing = true)
public class JvmMetricsAutoConfiguration {
@Bean

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -30,7 +30,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
@ -49,7 +48,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnClass({ MeterRegistry.class, LoggerContext.class, LoggerFactory.class })
@ConditionalOnBean(MeterRegistry.class)
@Conditional(LogbackLoggingCondition.class)
@ConditionalOnProperty(value = "management.metrics.binders.logback.enabled", matchIfMissing = true)
public class LogbackMetricsAutoConfiguration {
@Bean

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -43,21 +42,18 @@ import org.springframework.context.annotation.Configuration;
public class SystemMetricsAutoConfiguration {
@Bean
@ConditionalOnProperty(value = "management.metrics.binders.uptime.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
public UptimeMetrics uptimeMetrics() {
return new UptimeMetrics();
}
@Bean
@ConditionalOnProperty(value = "management.metrics.binders.processor.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
public ProcessorMetrics processorMetrics() {
return new ProcessorMetrics();
}
@Bean
@ConditionalOnProperty(name = "management.metrics.binders.files.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
public FileDescriptorMetrics fileDescriptorMetrics() {
return new FileDescriptorMetrics();

@ -188,54 +188,6 @@
"name": "management.info.git.mode",
"defaultValue": "simple"
},
{
"name": "management.metrics.binders.files.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable files metrics.",
"defaultValue": true,
"deprecation": {
"replacement": "management.metrics.enable.process.files",
"reason": "Instead, filter 'process.files' metrics."
}
},
{
"name": "management.metrics.binders.jvm.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable JVM metrics.",
"defaultValue": true,
"deprecation": {
"replacement": "management.metrics.enable.jvm",
"reason": "Instead, disable JvmMetricsAutoConfiguration or filter 'jvm' metrics."
}
},
{
"name": "management.metrics.binders.logback.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable Logback metrics.",
"defaultValue": true,
"deprecation": {
"replacement": "management.metrics.enable.logback",
"reason": "Instead, disable LogbackMetricsAutoConfiguration or filter 'logback' metrics."
}
},
{
"name": "management.metrics.binders.processor.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable processor metrics.",
"defaultValue": true,
"deprecation": {
"reason": "Instead, filter 'system.cpu' and 'process.cpu' metrics."
}
},
{
"name": "management.metrics.binders.uptime.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable uptime metrics.",
"defaultValue": true,
"deprecation": {
"reason": "Instead, filter 'process.uptime' and 'process.start.time' metrics."
}
},
{
"name": "management.metrics.export.jmx.enabled",
"type": "java.lang.Boolean",
@ -1278,6 +1230,59 @@
"level": "error"
}
},
{
"name": "management.metrics.binders.files.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable files metrics.",
"defaultValue": true,
"deprecation": {
"level": "error",
"replacement": "management.metrics.enable.process.files",
"reason": "Instead, filter 'process.files' metrics."
}
},
{
"name": "management.metrics.binders.jvm.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable JVM metrics.",
"defaultValue": true,
"deprecation": {
"level": "error",
"replacement": "management.metrics.enable.jvm",
"reason": "Instead, disable JvmMetricsAutoConfiguration or filter 'jvm' metrics."
}
},
{
"name": "management.metrics.binders.logback.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable Logback metrics.",
"defaultValue": true,
"deprecation": {
"level": "error",
"replacement": "management.metrics.enable.logback",
"reason": "Instead, disable LogbackMetricsAutoConfiguration or filter 'logback' metrics."
}
},
{
"name": "management.metrics.binders.processor.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable processor metrics.",
"defaultValue": true,
"deprecation": {
"level": "error",
"reason": "Instead, filter 'system.cpu' and 'process.cpu' metrics."
}
},
{
"name": "management.metrics.binders.uptime.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable uptime metrics.",
"defaultValue": true,
"deprecation": {
"level": "error",
"reason": "Instead, filter 'process.uptime' and 'process.start.time' metrics."
}
},
{
"name": "management.port",
"type": "java.lang.Integer",

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -30,7 +30,6 @@ import org.springframework.mock.env.MockEnvironment;
import org.springframework.util.ObjectUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@ -79,13 +78,6 @@ public class DefaultEndpointObjectNameFactoryTests {
assertUniqueObjectName();
}
@Test
@Deprecated
public void generateObjectNameWithUniqueNamesDeprecatedProperty() {
this.properties.setUniqueNames(true);
assertUniqueObjectName();
}
private void assertUniqueObjectName() {
ExposableJmxEndpoint endpoint = endpoint(EndpointId.of("test"));
String id = ObjectUtils.getIdentityHexString(endpoint);
@ -94,17 +86,6 @@ public class DefaultEndpointObjectNameFactoryTests {
"org.springframework.boot:type=Endpoint,name=Test,identity=" + id);
}
@Test
@Deprecated
public void generateObjectNameWithUniqueNamesDeprecatedPropertyMismatchMainProperty() {
this.environment.setProperty("spring.jmx.unique-names", "false");
this.properties.setUniqueNames(true);
assertThatIllegalArgumentException()
.isThrownBy(() -> generateObjectName(endpoint(EndpointId.of("test"))))
.withMessageContaining("spring.jmx.unique-names")
.withMessageContaining("management.endpoints.jmx.unique-names");
}
@Test
public void generateObjectNameWithStaticNames() {
this.properties.getStaticNames().setProperty("counter", "42");

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -50,17 +50,6 @@ public class JvmMetricsAutoConfigurationTests {
.hasSingleBean(ClassLoaderMetrics.class));
}
@Test
@Deprecated
public void allowsJvmMetricsToBeDisabled() {
this.contextRunner
.withPropertyValues("management.metrics.binders.jvm.enabled=false")
.run((context) -> assertThat(context).doesNotHaveBean(JvmGcMetrics.class)
.doesNotHaveBean(JvmMemoryMetrics.class)
.doesNotHaveBean(JvmThreadMetrics.class)
.doesNotHaveBean(ClassLoaderMetrics.class));
}
@Test
public void allowsCustomJvmGcMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomJvmGcMetricsConfiguration.class)

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -45,15 +45,6 @@ public class LogbackMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(LogbackMetrics.class));
}
@Test
@Deprecated
public void allowsLogbackMetricsToBeDisabled() {
this.contextRunner
.withPropertyValues("management.metrics.binders.logback.enabled=false")
.run((context) -> assertThat(context)
.doesNotHaveBean(LogbackMetrics.class));
}
@Test
public void allowsCustomLogbackMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomLogbackMetricsConfiguration.class)

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -47,15 +47,6 @@ public class SystemMetricsAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(UptimeMetrics.class));
}
@Test
@Deprecated
public void allowsUptimeMetricsToBeDisabled() {
this.contextRunner
.withPropertyValues("management.metrics.binders.uptime.enabled=false")
.run((context) -> assertThat(context)
.doesNotHaveBean(UptimeMetrics.class));
}
@Test
public void allowsCustomUptimeMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomUptimeMetricsConfiguration.class)
@ -69,15 +60,6 @@ public class SystemMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(ProcessorMetrics.class));
}
@Test
@Deprecated
public void allowsProcessorMetricsToBeDisabled() {
this.contextRunner
.withPropertyValues("management.metrics.binders.processor.enabled=false")
.run((context) -> assertThat(context)
.doesNotHaveBean(ProcessorMetrics.class));
}
@Test
public void allowsCustomProcessorMetricsToBeUsed() {
this.contextRunner
@ -93,15 +75,6 @@ public class SystemMetricsAutoConfigurationTests {
.hasSingleBean(FileDescriptorMetrics.class));
}
@Test
@Deprecated
public void allowsFileDescriptorMetricsToBeDisabled() {
this.contextRunner
.withPropertyValues("management.metrics.binders.files.enabled=false")
.run((context) -> assertThat(context)
.doesNotHaveBean(FileDescriptorMetrics.class));
}
@Test
public void allowsCustomFileDescriptorMetricsToBeUsed() {
this.contextRunner

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -17,8 +17,6 @@
package org.springframework.boot.actuate.health;
import java.time.Duration;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import reactor.core.publisher.Flux;
@ -45,7 +43,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
private final Function<Mono<Health>, Mono<Health>> timeoutCompose;
/**
* Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the
* given {@code registry}.

@ -1,73 +0,0 @@
/*
* Copyright 2012-2018 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
*
* http://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.boot.actuate.health;
import java.util.Map;
import java.util.function.Function;
import org.springframework.util.Assert;
/**
* Factory to create a {@link CompositeReactiveHealthIndicator}.
*
* @author Stephane Nicoll
* @since 2.0.0
* @deprecated since 2.1.0 in favor of
* {@link CompositeReactiveHealthIndicator#CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)}
*/
@Deprecated
public class CompositeReactiveHealthIndicatorFactory {
private final Function<String, String> healthIndicatorNameFactory;
public CompositeReactiveHealthIndicatorFactory(
Function<String, String> healthIndicatorNameFactory) {
this.healthIndicatorNameFactory = healthIndicatorNameFactory;
}
public CompositeReactiveHealthIndicatorFactory() {
this(new HealthIndicatorNameFactory());
}
/**
* Create a {@link CompositeReactiveHealthIndicator} based on the specified health
* indicators. Each {@link HealthIndicator} are wrapped to a
* {@link HealthIndicatorReactiveAdapter}. If two instances share the same name, the
* reactive variant takes precedence.
* @param healthAggregator the {@link HealthAggregator}
* @param reactiveHealthIndicators the {@link ReactiveHealthIndicator} instances
* mapped by name
* @param healthIndicators the {@link HealthIndicator} instances mapped by name if
* any.
* @return a {@link ReactiveHealthIndicator} that delegates to the specified
* {@code reactiveHealthIndicators}.
*/
public CompositeReactiveHealthIndicator createReactiveHealthIndicator(
HealthAggregator healthAggregator,
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(healthAggregator, "HealthAggregator must not be null");
Assert.notNull(reactiveHealthIndicators,
"ReactiveHealthIndicators must not be null");
ReactiveHealthIndicatorRegistryFactory factory = new ReactiveHealthIndicatorRegistryFactory(
this.healthIndicatorNameFactory);
return new CompositeReactiveHealthIndicator(healthAggregator,
factory.createReactiveHealthIndicatorRegistry(reactiveHealthIndicators,
healthIndicators));
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -34,7 +34,6 @@ import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.Timer.Builder;
import io.micrometer.core.instrument.Timer.Sample;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.HttpStatus;
import org.springframework.web.filter.OncePerRequestFilter;

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,103 +0,0 @@
/*
* Copyright 2012-2018 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
*
* http://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.boot.actuate.health;
import java.util.Collections;
import java.util.Map;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* Tests for {@link CompositeReactiveHealthIndicatorFactory}.
*
* @author Stephane Nicoll
*/
@Deprecated
public class CompositeReactiveHealthIndicatorFactoryTests {
private static final Health UP = new Health.Builder().status(Status.UP).build();
private static final Health DOWN = new Health.Builder().status(Status.DOWN).build();
@Test
public void noHealthIndicator() {
ReactiveHealthIndicator healthIndicator = createHealthIndicator(
Collections.singletonMap("test", () -> Mono.just(UP)), null);
StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.UP);
assertThat(h.getDetails()).containsOnlyKeys("test");
}).verifyComplete();
}
@Test
public void defaultHealthIndicatorNameFactory() {
ReactiveHealthIndicator healthIndicator = new CompositeReactiveHealthIndicatorFactory()
.createReactiveHealthIndicator(new OrderedHealthAggregator(), Collections
.singletonMap("myHealthIndicator", () -> Mono.just(UP)), null);
StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.UP);
assertThat(h.getDetails()).containsOnlyKeys("my");
}).verifyComplete();
}
@Test
public void healthIndicatorIsAdapted() {
ReactiveHealthIndicator healthIndicator = createHealthIndicator(
Collections.singletonMap("test", () -> Mono.just(UP)),
Collections.singletonMap("regular", () -> DOWN));
StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.DOWN);
assertThat(h.getDetails()).containsOnlyKeys("test", "regular");
}).verifyComplete();
}
@Test
public void reactiveHealthIndicatorTakesPrecedence() {
ReactiveHealthIndicator reactiveHealthIndicator = mock(
ReactiveHealthIndicator.class);
given(reactiveHealthIndicator.health()).willReturn(Mono.just(UP));
HealthIndicator regularHealthIndicator = mock(HealthIndicator.class);
given(regularHealthIndicator.health()).willReturn(UP);
ReactiveHealthIndicator healthIndicator = createHealthIndicator(
Collections.singletonMap("test", reactiveHealthIndicator),
Collections.singletonMap("test", regularHealthIndicator));
StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.UP);
assertThat(h.getDetails()).containsOnlyKeys("test");
}).verifyComplete();
verify(reactiveHealthIndicator, times(1)).health();
verify(regularHealthIndicator, never()).health();
}
private ReactiveHealthIndicator createHealthIndicator(
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
return new CompositeReactiveHealthIndicatorFactory((n) -> n)
.createReactiveHealthIndicator(new OrderedHealthAggregator(),
reactiveHealthIndicators, healthIndicators);
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -24,7 +24,6 @@ import java.util.List;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -831,17 +830,6 @@ public class RabbitProperties {
this.defaultReceiveQueue = defaultReceiveQueue;
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.template.default-receive-queue")
public String getQueue() {
return getDefaultReceiveQueue();
}
@Deprecated
public void setQueue(String queue) {
setDefaultReceiveQueue(queue);
}
}
public static class Retry {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -23,7 +23,6 @@ import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.QueryOptions;
import com.datastax.driver.core.SocketOptions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@ -60,14 +59,8 @@ public class CassandraAutoConfiguration {
map.from(properties::getUsername).whenNonNull().to((username) -> builder
.withCredentials(username, properties.getPassword()));
map.from(properties::getCompression).whenNonNull().to(builder::withCompression);
map.from(properties::getLoadBalancingPolicy).whenNonNull()
.as(BeanUtils::instantiateClass).to(builder::withLoadBalancingPolicy);
QueryOptions queryOptions = getQueryOptions(properties);
map.from(queryOptions).to(builder::withQueryOptions);
map.from(properties::getReconnectionPolicy).whenNonNull()
.as(BeanUtils::instantiateClass).to(builder::withReconnectionPolicy);
map.from(properties::getRetryPolicy).whenNonNull().as(BeanUtils::instantiateClass)
.to(builder::withRetryPolicy);
SocketOptions socketOptions = getSocketOptions(properties);
map.from(socketOptions).to(builder::withSocketOptions);
map.from(properties::isSsl).whenTrue().toCall(builder::withSSL);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -26,12 +26,8 @@ import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.ProtocolOptions;
import com.datastax.driver.core.ProtocolOptions.Compression;
import com.datastax.driver.core.QueryOptions;
import com.datastax.driver.core.policies.LoadBalancingPolicy;
import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.datastax.driver.core.policies.RetryPolicy;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
/**
@ -82,11 +78,6 @@ public class CassandraProperties {
*/
private Compression compression = Compression.NONE;
/**
* Class name of the load balancing policy. The class must have a default constructor.
*/
private Class<? extends LoadBalancingPolicy> loadBalancingPolicy;
/**
* Queries consistency level.
*/
@ -102,16 +93,6 @@ public class CassandraProperties {
*/
private int fetchSize = QueryOptions.DEFAULT_FETCH_SIZE;
/**
* Class name of the reconnection policy. The class must have a default constructor.
*/
private Class<? extends ReconnectionPolicy> reconnectionPolicy;
/**
* Class name of the retry policy. The class must have a default constructor.
*/
private Class<? extends RetryPolicy> retryPolicy;
/**
* Socket option: connection time out.
*/
@ -195,18 +176,6 @@ public class CassandraProperties {
this.compression = compression;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends LoadBalancingPolicy> getLoadBalancingPolicy() {
return this.loadBalancingPolicy;
}
@Deprecated
public void setLoadBalancingPolicy(
Class<? extends LoadBalancingPolicy> loadBalancingPolicy) {
this.loadBalancingPolicy = loadBalancingPolicy;
}
public ConsistencyLevel getConsistencyLevel() {
return this.consistencyLevel;
}
@ -231,29 +200,6 @@ public class CassandraProperties {
this.fetchSize = fetchSize;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends ReconnectionPolicy> getReconnectionPolicy() {
return this.reconnectionPolicy;
}
@Deprecated
public void setReconnectionPolicy(
Class<? extends ReconnectionPolicy> reconnectionPolicy) {
this.reconnectionPolicy = reconnectionPolicy;
}
@DeprecatedConfigurationProperty(reason = "Implement a ClusterBuilderCustomizer bean instead.")
@Deprecated
public Class<? extends RetryPolicy> getRetryPolicy() {
return this.retryPolicy;
}
@Deprecated
public void setRetryPolicy(Class<? extends RetryPolicy> retryPolicy) {
this.retryPolicy = retryPolicy;
}
public Duration getConnectTimeout() {
return this.connectTimeout;
}

@ -17,8 +17,6 @@
package org.springframework.boot.autoconfigure.influx;
import okhttp3.OkHttpClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.influxdb.InfluxDB;
import org.influxdb.impl.InfluxDBImpl;
@ -44,33 +42,20 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties(InfluxDbProperties.class)
public class InfluxDbAutoConfiguration {
private static final Log logger = LogFactory.getLog(InfluxDbAutoConfiguration.class);
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty("spring.influx.url")
public InfluxDB influxDb(InfluxDbProperties properties,
ObjectProvider<InfluxDbOkHttpClientBuilderProvider> builder,
ObjectProvider<OkHttpClient.Builder> deprecatedBuilder) {
ObjectProvider<InfluxDbOkHttpClientBuilderProvider> builder) {
return new InfluxDBImpl(properties.getUrl(), properties.getUser(),
properties.getPassword(), determineBuilder(builder.getIfAvailable(),
deprecatedBuilder.getIfAvailable()));
properties.getPassword(), determineBuilder(builder.getIfAvailable()));
}
@Deprecated
private static OkHttpClient.Builder determineBuilder(
InfluxDbOkHttpClientBuilderProvider builder,
OkHttpClient.Builder deprecatedBuilder) {
InfluxDbOkHttpClientBuilderProvider builder) {
if (builder != null) {
return builder.get();
}
else if (deprecatedBuilder != null) {
logger.warn(
"InfluxDB client customizations using a OkHttpClient.Builder is deprecated, register a "
+ InfluxDbOkHttpClientBuilderProvider.class.getSimpleName()
+ " bean instead");
return deprecatedBuilder;
}
return new OkHttpClient.Builder();
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -110,17 +110,6 @@ public class JmsPoolConnectionFactoryProperties {
this.maxConnections = maxConnections;
}
@Deprecated
public int getMaximumActiveSessionPerConnection() {
return getMaxSessionsPerConnection();
}
@Deprecated
public void setMaximumActiveSessionPerConnection(
int maximumActiveSessionPerConnection) {
setMaxSessionsPerConnection(maximumActiveSessionPerConnection);
}
public int getMaxSessionsPerConnection() {
return this.maxSessionsPerConnection;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -33,7 +33,6 @@ import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.core.io.Resource;
@ -729,20 +728,6 @@ public class KafkaProperties {
this.bootstrapServers = bootstrapServers;
}
@DeprecatedConfigurationProperty(replacement = "spring.kafka.streams.cache-max-size-buffering")
@Deprecated
public Integer getCacheMaxBytesBuffering() {
return (this.cacheMaxSizeBuffering != null)
? (int) this.cacheMaxSizeBuffering.toBytes() : null;
}
@Deprecated
public void setCacheMaxBytesBuffering(Integer cacheMaxBytesBuffering) {
DataSize cacheMaxSizeBuffering = (cacheMaxBytesBuffering != null)
? DataSize.ofBytes(cacheMaxBytesBuffering) : null;
setCacheMaxSizeBuffering(cacheMaxSizeBuffering);
}
public DataSize getCacheMaxSizeBuffering() {
return this.cacheMaxSizeBuffering;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -161,16 +161,6 @@ public class OAuth2ClientProperties {
this.redirectUri = redirectUri;
}
@Deprecated
public String getRedirectUriTemplate() {
return getRedirectUri();
}
@Deprecated
public void setRedirectUriTemplate(String redirectUri) {
setRedirectUri(redirectUri);
}
public Set<String> getScope() {
return this.scope;
}

@ -30,7 +30,6 @@ import java.util.Map;
import java.util.TimeZone;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.boot.web.server.Compression;
@ -330,11 +329,6 @@ public class ServerProperties {
*/
private DataSize maxHttpPostSize = DataSize.ofMegabytes(2);
/**
* Maximum size of the HTTP message header.
*/
private DataSize maxHttpHeaderSize = DataSize.ofBytes(0);
/**
* Maximum amount of request body to swallow.
*/
@ -504,17 +498,6 @@ public class ServerProperties {
this.maxConnections = maxConnections;
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "server.max-http-header-size")
public DataSize getMaxHttpHeaderSize() {
return this.maxHttpHeaderSize;
}
@Deprecated
public void setMaxHttpHeaderSize(DataSize maxHttpHeaderSize) {
this.maxHttpHeaderSize = maxHttpHeaderSize;
}
public DataSize getMaxSwallowSize() {
return this.maxSwallowSize;
}

@ -85,7 +85,7 @@ public class TomcatWebServerFactoryCustomizer implements
tomcatProperties.getMaxThreads()));
propertyMapper.from(tomcatProperties::getMinSpareThreads).when(this::isPositive)
.to((minSpareThreads) -> customizeMinThreads(factory, minSpareThreads));
propertyMapper.from(this::determineMaxHttpHeaderSize).whenNonNull()
propertyMapper.from(this.serverProperties.getMaxHttpHeaderSize()).whenNonNull()
.asInt(DataSize::toBytes).when(this::isPositive)
.to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory,
maxHttpHeaderSize));
@ -118,13 +118,6 @@ public class TomcatWebServerFactoryCustomizer implements
return value > 0;
}
@SuppressWarnings("deprecation")
private DataSize determineMaxHttpHeaderSize() {
return (this.serverProperties.getTomcat().getMaxHttpHeaderSize().toBytes() > 0)
? this.serverProperties.getTomcat().getMaxHttpHeaderSize()
: this.serverProperties.getMaxHttpHeaderSize();
}
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
int acceptCount) {
factory.addConnectorCustomizers((connector) -> {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -325,18 +325,6 @@ public class RabbitAutoConfigurationTests {
});
}
@Test
@Deprecated
public void testRabbitTemplateDefaultQueue() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.template.queue:default-queue")
.run((context) -> {
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
assertThat(rabbitTemplate).hasFieldOrPropertyWithValue(
"defaultReceiveQueue", "default-queue");
});
}
@Test
public void testRabbitTemplateMandatory() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -87,35 +87,6 @@ public class InfluxDbAutoConfigurationTests {
});
}
@Test
public void influxDbWithOkHttpClientBuilderProviderIgnoreOkHttpClientBuilder() {
this.contextRunner
.withUserConfiguration(CustomOkHttpClientBuilderConfig.class,
CustomOkHttpClientBuilderProviderConfig.class)
.withPropertyValues("spring.influx.url=http://localhost")
.run((context) -> {
assertThat(context.getBeansOfType(InfluxDB.class)).hasSize(1);
int readTimeout = getReadTimeoutProperty(context);
assertThat(readTimeout).isEqualTo(40_000);
assertThat(this.output.toString()).doesNotContain(
"InfluxDB client customizations using a OkHttpClient.Builder is deprecated");
});
}
@Test
@Deprecated
public void influxDbWithOkHttpClientBuilder() {
this.contextRunner.withUserConfiguration(CustomOkHttpClientBuilderConfig.class)
.withPropertyValues("spring.influx.url=http://localhost")
.run((context) -> {
assertThat(context.getBeansOfType(InfluxDB.class)).hasSize(1);
int readTimeout = getReadTimeoutProperty(context);
assertThat(readTimeout).isEqualTo(30_000);
assertThat(this.output.toString()).contains(
"InfluxDB client customizations using a OkHttpClient.Builder is deprecated");
});
}
private int getReadTimeoutProperty(AssertableApplicationContext context) {
InfluxDB influxDB = context.getBean(InfluxDB.class);
Retrofit retrofit = (Retrofit) ReflectionTestUtils.getField(influxDB, "retrofit");
@ -133,14 +104,4 @@ public class InfluxDbAutoConfigurationTests {
}
@Configuration
static class CustomOkHttpClientBuilderConfig {
@Bean
public OkHttpClient.Builder builder() {
return new OkHttpClient.Builder().readTimeout(30, TimeUnit.SECONDS);
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.
@ -217,22 +217,6 @@ public class ActiveMQAutoConfigurationTests {
});
}
@Test
@Deprecated
public void customPoolConnectionFactoryIsAppliedWithDeprecatedSettings() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
.withPropertyValues("spring.activemq.pool.enabled=true",
"spring.activemq.pool.maximumActiveSessionPerConnection=1024")
.run((context) -> {
assertThat(context.getBeansOfType(JmsPoolConnectionFactory.class))
.hasSize(1);
JmsPoolConnectionFactory connectionFactory = context
.getBean(JmsPoolConnectionFactory.class);
assertThat(connectionFactory.getMaxSessionsPerConnection())
.isEqualTo(1024);
});
}
@Test
public void poolConnectionFactoryConfiguration() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)

@ -401,21 +401,6 @@ public class ArtemisAutoConfigurationTests {
});
}
@Test
public void customPoolConnectionFactoryIsAppliedWithDeprecatedSettings() {
this.contextRunner
.withPropertyValues("spring.artemis.pool.enabled=true",
"spring.artemis.pool.maximumActiveSessionPerConnection=1024")
.run((context) -> {
assertThat(context.getBeansOfType(JmsPoolConnectionFactory.class))
.hasSize(1);
JmsPoolConnectionFactory connectionFactory = context
.getBean(JmsPoolConnectionFactory.class);
assertThat(connectionFactory.getMaxSessionsPerConnection())
.isEqualTo(1024);
});
}
@Test
public void poolConnectionFactoryConfiguration() {
this.contextRunner.withPropertyValues("spring.artemis.pool.enabled:true")

@ -351,22 +351,6 @@ public class KafkaAutoConfigurationTests {
});
}
@Test
@Deprecated
public void streamPropertiesWithCustomCacheMaxBytesBuffering() {
this.contextRunner.withUserConfiguration(EnableKafkaStreamsConfiguration.class)
.withPropertyValues("spring.application.name=appName",
"spring.kafka.streams.cache-max-bytes-buffering=42")
.run((context) -> {
Properties configs = context.getBean(
KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME,
KafkaStreamsConfiguration.class).asProperties();
assertThat(
configs.get(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG))
.isEqualTo("42");
});
}
@Test
public void streamsApplicationIdUsesMainApplicationNameByDefault() {
this.contextRunner.withUserConfiguration(EnableKafkaStreamsConfiguration.class)

@ -145,16 +145,6 @@ public class TomcatWebServerFactoryCustomizerTests {
.isEqualTo(DataSize.ofKilobytes(8).toBytes()));
}
@Test
@Deprecated
public void customMaxHttpHeaderSizeWithDeprecatedProperty() {
bind("server.max-http-header-size=4KB",
"server.tomcat.max-http-header-size=1024");
customizeAndRunServer((server) -> assertThat(((AbstractHttp11Protocol<?>) server
.getTomcat().getConnector().getProtocolHandler()).getMaxHttpHeaderSize())
.isEqualTo(DataSize.ofKilobytes(1).toBytes()));
}
@Test
public void customMaxSwallowSize() {
bind("server.tomcat.max-swallow-size=10MB");

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

@ -544,24 +544,6 @@ public class RestTemplateBuilderTests {
.isInstanceOf(BufferingClientHttpRequestFactory.class);
}
@Test
@SuppressWarnings("deprecation")
public void connectTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class)
.setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
}
@Test
@SuppressWarnings("deprecation")
public void readTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(Duration.ofMillis(1234))
.build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
}
public static class RestTemplateSubclass extends RestTemplate {
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-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.

Loading…
Cancel
Save