Commit b8b5686a authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #16013 from Gigaxel

* pr/16013:
  Polish "Remove code deprecated in 2.1"
  Remove code deprecated in 2.1
parents 5e441897 715db153
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -48,23 +48,8 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory { ...@@ -48,23 +48,8 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
this.properties = properties; this.properties = properties;
this.mBeanServer = mBeanServer; this.mBeanServer = mBeanServer;
this.contextId = contextId; this.contextId = contextId;
this.uniqueNames = determineUniqueNames(environment, properties); this.uniqueNames = environment.getProperty("spring.jmx.unique-names",
} Boolean.class, false);
@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;
} }
@Override @Override
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -21,7 +21,6 @@ import java.util.Properties; ...@@ -21,7 +21,6 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -41,11 +40,6 @@ public class JmxEndpointProperties { ...@@ -41,11 +40,6 @@ public class JmxEndpointProperties {
*/ */
private String domain = "org.springframework.boot"; 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 * Additional static properties to append to all ObjectNames of MBeans representing
* Endpoints. * Endpoints.
...@@ -71,17 +65,6 @@ public class JmxEndpointProperties { ...@@ -71,17 +65,6 @@ public class JmxEndpointProperties {
this.domain = domain; 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() { public Properties getStaticNames() {
return this.staticNames; return this.staticNames;
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; ...@@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -41,7 +40,6 @@ import org.springframework.context.annotation.Configuration; ...@@ -41,7 +40,6 @@ import org.springframework.context.annotation.Configuration;
@AutoConfigureAfter(MetricsAutoConfiguration.class) @AutoConfigureAfter(MetricsAutoConfiguration.class)
@ConditionalOnClass(MeterRegistry.class) @ConditionalOnClass(MeterRegistry.class)
@ConditionalOnBean(MeterRegistry.class) @ConditionalOnBean(MeterRegistry.class)
@ConditionalOnProperty(value = "management.metrics.binders.jvm.enabled", matchIfMissing = true)
public class JvmMetricsAutoConfiguration { public class JvmMetricsAutoConfiguration {
@Bean @Bean
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; ...@@ -30,7 +30,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.ConditionContext;
...@@ -49,7 +48,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata; ...@@ -49,7 +48,6 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnClass({ MeterRegistry.class, LoggerContext.class, LoggerFactory.class }) @ConditionalOnClass({ MeterRegistry.class, LoggerContext.class, LoggerFactory.class })
@ConditionalOnBean(MeterRegistry.class) @ConditionalOnBean(MeterRegistry.class)
@Conditional(LogbackLoggingCondition.class) @Conditional(LogbackLoggingCondition.class)
@ConditionalOnProperty(value = "management.metrics.binders.logback.enabled", matchIfMissing = true)
public class LogbackMetricsAutoConfiguration { public class LogbackMetricsAutoConfiguration {
@Bean @Bean
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; ...@@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -43,21 +42,18 @@ import org.springframework.context.annotation.Configuration; ...@@ -43,21 +42,18 @@ import org.springframework.context.annotation.Configuration;
public class SystemMetricsAutoConfiguration { public class SystemMetricsAutoConfiguration {
@Bean @Bean
@ConditionalOnProperty(value = "management.metrics.binders.uptime.enabled", matchIfMissing = true)
@ConditionalOnMissingBean @ConditionalOnMissingBean
public UptimeMetrics uptimeMetrics() { public UptimeMetrics uptimeMetrics() {
return new UptimeMetrics(); return new UptimeMetrics();
} }
@Bean @Bean
@ConditionalOnProperty(value = "management.metrics.binders.processor.enabled", matchIfMissing = true)
@ConditionalOnMissingBean @ConditionalOnMissingBean
public ProcessorMetrics processorMetrics() { public ProcessorMetrics processorMetrics() {
return new ProcessorMetrics(); return new ProcessorMetrics();
} }
@Bean @Bean
@ConditionalOnProperty(name = "management.metrics.binders.files.enabled", matchIfMissing = true)
@ConditionalOnMissingBean @ConditionalOnMissingBean
public FileDescriptorMetrics fileDescriptorMetrics() { public FileDescriptorMetrics fileDescriptorMetrics() {
return new FileDescriptorMetrics(); return new FileDescriptorMetrics();
......
...@@ -188,54 +188,6 @@ ...@@ -188,54 +188,6 @@
"name": "management.info.git.mode", "name": "management.info.git.mode",
"defaultValue": "simple" "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", "name": "management.metrics.export.jmx.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
...@@ -1278,6 +1230,59 @@ ...@@ -1278,6 +1230,59 @@
"level": "error" "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", "name": "management.port",
"type": "java.lang.Integer", "type": "java.lang.Integer",
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -30,7 +30,6 @@ import org.springframework.mock.env.MockEnvironment; ...@@ -30,7 +30,6 @@ import org.springframework.mock.env.MockEnvironment;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import static org.assertj.core.api.Assertions.assertThat; 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.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -79,13 +78,6 @@ public class DefaultEndpointObjectNameFactoryTests { ...@@ -79,13 +78,6 @@ public class DefaultEndpointObjectNameFactoryTests {
assertUniqueObjectName(); assertUniqueObjectName();
} }
@Test
@Deprecated
public void generateObjectNameWithUniqueNamesDeprecatedProperty() {
this.properties.setUniqueNames(true);
assertUniqueObjectName();
}
private void assertUniqueObjectName() { private void assertUniqueObjectName() {
ExposableJmxEndpoint endpoint = endpoint(EndpointId.of("test")); ExposableJmxEndpoint endpoint = endpoint(EndpointId.of("test"));
String id = ObjectUtils.getIdentityHexString(endpoint); String id = ObjectUtils.getIdentityHexString(endpoint);
...@@ -94,17 +86,6 @@ public class DefaultEndpointObjectNameFactoryTests { ...@@ -94,17 +86,6 @@ public class DefaultEndpointObjectNameFactoryTests {
"org.springframework.boot:type=Endpoint,name=Test,identity=" + id); "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 @Test
public void generateObjectNameWithStaticNames() { public void generateObjectNameWithStaticNames() {
this.properties.getStaticNames().setProperty("counter", "42"); this.properties.getStaticNames().setProperty("counter", "42");
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -50,17 +50,6 @@ public class JvmMetricsAutoConfigurationTests { ...@@ -50,17 +50,6 @@ public class JvmMetricsAutoConfigurationTests {
.hasSingleBean(ClassLoaderMetrics.class)); .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 @Test
public void allowsCustomJvmGcMetricsToBeUsed() { public void allowsCustomJvmGcMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomJvmGcMetricsConfiguration.class) this.contextRunner.withUserConfiguration(CustomJvmGcMetricsConfiguration.class)
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -45,15 +45,6 @@ public class LogbackMetricsAutoConfigurationTests { ...@@ -45,15 +45,6 @@ public class LogbackMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(LogbackMetrics.class)); (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 @Test
public void allowsCustomLogbackMetricsToBeUsed() { public void allowsCustomLogbackMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomLogbackMetricsConfiguration.class) this.contextRunner.withUserConfiguration(CustomLogbackMetricsConfiguration.class)
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -47,15 +47,6 @@ public class SystemMetricsAutoConfigurationTests { ...@@ -47,15 +47,6 @@ public class SystemMetricsAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(UptimeMetrics.class)); .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 @Test
public void allowsCustomUptimeMetricsToBeUsed() { public void allowsCustomUptimeMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomUptimeMetricsConfiguration.class) this.contextRunner.withUserConfiguration(CustomUptimeMetricsConfiguration.class)
...@@ -69,15 +60,6 @@ public class SystemMetricsAutoConfigurationTests { ...@@ -69,15 +60,6 @@ public class SystemMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(ProcessorMetrics.class)); (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 @Test
public void allowsCustomProcessorMetricsToBeUsed() { public void allowsCustomProcessorMetricsToBeUsed() {
this.contextRunner this.contextRunner
...@@ -93,15 +75,6 @@ public class SystemMetricsAutoConfigurationTests { ...@@ -93,15 +75,6 @@ public class SystemMetricsAutoConfigurationTests {
.hasSingleBean(FileDescriptorMetrics.class)); .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 @Test
public void allowsCustomFileDescriptorMetricsToBeUsed() { public void allowsCustomFileDescriptorMetricsToBeUsed() {
this.contextRunner this.contextRunner
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -41,17 +41,6 @@ public interface PathMapper { ...@@ -41,17 +41,6 @@ public interface PathMapper {
*/ */
String getRootPath(EndpointId endpointId); String getRootPath(EndpointId endpointId);
/**
* Returns an {@link PathMapper} that uses the endpoint ID as the path.
* @return an {@link PathMapper} that uses the lowercase endpoint ID as the path
* @deprecated since 2.1.0 in favor of {@link #getRootPath(List, EndpointId)} with a
* {@code null} list
*/
@Deprecated
static PathMapper useEndpointId() {
return EndpointId::toString;
}
/** /**
* Resolve the root path for the specified {@code endpointId} from the given path * Resolve the root path for the specified {@code endpointId} from the given path
* mappers. If no mapper matches then the ID itself is returned. * mappers. If no mapper matches then the ID itself is returned.
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -33,17 +33,6 @@ public class CompositeHealthIndicator implements HealthIndicator { ...@@ -33,17 +33,6 @@ public class CompositeHealthIndicator implements HealthIndicator {
private final HealthAggregator aggregator; private final HealthAggregator aggregator;
/**
* Create a new {@link CompositeHealthIndicator}.
* @param healthAggregator the health aggregator
* @deprecated since 2.1.0 in favor of
* {@link #CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)}
*/
@Deprecated
public CompositeHealthIndicator(HealthAggregator healthAggregator) {
this(healthAggregator, new DefaultHealthIndicatorRegistry());
}
/** /**
* Create a new {@link CompositeHealthIndicator} from the specified indicators. * Create a new {@link CompositeHealthIndicator} from the specified indicators.
* @param healthAggregator the health aggregator * @param healthAggregator the health aggregator
...@@ -67,20 +56,6 @@ public class CompositeHealthIndicator implements HealthIndicator { ...@@ -67,20 +56,6 @@ public class CompositeHealthIndicator implements HealthIndicator {
this.registry = registry; this.registry = registry;
} }
/**
* Adds the given {@code healthIndicator}, associating it with the given {@code name}.
* @param name the name of the indicator
* @param indicator the indicator
* @throws IllegalStateException if an indicator with the given {@code name} is
* already registered.
* @deprecated since 2.1.0 in favor of
* {@link HealthIndicatorRegistry#register(String, HealthIndicator)}
*/
@Deprecated
public void addHealthIndicator(String name, HealthIndicator indicator) {
this.registry.register(name, indicator);
}
/** /**
* Return the {@link HealthIndicatorRegistry} of this instance. * Return the {@link HealthIndicatorRegistry} of this instance.
* @return the registry of nested {@link HealthIndicator health indicators} * @return the registry of nested {@link HealthIndicator health indicators}
......
/*
* 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 CompositeHealthIndicator}.
*
* @author Stephane Nicoll
* @since 2.0.0
* @deprecated since 2.1.0 in favor of
* {@link CompositeHealthIndicator#CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)}
*/
@Deprecated
public class CompositeHealthIndicatorFactory {
private final Function<String, String> healthIndicatorNameFactory;
public CompositeHealthIndicatorFactory() {
this(new HealthIndicatorNameFactory());
}
public CompositeHealthIndicatorFactory(
Function<String, String> healthIndicatorNameFactory) {
this.healthIndicatorNameFactory = healthIndicatorNameFactory;
}
/**
* Create a {@link CompositeHealthIndicator} based on the specified health indicators.
* @param healthAggregator the {@link HealthAggregator}
* @param healthIndicators the {@link HealthIndicator} instances mapped by name
* @return a {@link HealthIndicator} that delegates to the specified
* {@code healthIndicators}.
*/
public CompositeHealthIndicator createHealthIndicator(
HealthAggregator healthAggregator,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(healthAggregator, "HealthAggregator must not be null");
Assert.notNull(healthIndicators, "HealthIndicators must not be null");
HealthIndicatorRegistryFactory factory = new HealthIndicatorRegistryFactory(
this.healthIndicatorNameFactory);
return new CompositeHealthIndicator(healthAggregator,
factory.createHealthIndicatorRegistry(healthIndicators));
}
}
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
package org.springframework.boot.actuate.health; package org.springframework.boot.actuate.health;
import java.time.Duration; import java.time.Duration;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
...@@ -45,33 +43,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator ...@@ -45,33 +43,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
private final Function<Mono<Health>, Mono<Health>> timeoutCompose; private final Function<Mono<Health>, Mono<Health>> timeoutCompose;
/**
* Create a new {@link CompositeReactiveHealthIndicator}.
* @param healthAggregator the health aggregator
* @deprecated since 2.1.0 in favor of
* {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)}
*/
@Deprecated
public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator) {
this(healthAggregator, new LinkedHashMap<>());
}
/**
* Create a new {@link CompositeReactiveHealthIndicator} from the specified
* indicators.
* @param healthAggregator the health aggregator
* @param indicators a map of {@link ReactiveHealthIndicator HealthIndicators} with
* the key being used as an indicator name.
* @deprecated since 2.1.0 in favor of
* {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)}
*/
@Deprecated
public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator,
Map<String, ReactiveHealthIndicator> indicators) {
this(healthAggregator, new DefaultReactiveHealthIndicatorRegistry(indicators));
}
/** /**
* Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the * Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the
* given {@code registry}. * given {@code registry}.
...@@ -86,23 +57,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator ...@@ -86,23 +57,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono; Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
} }
/**
* Add a {@link ReactiveHealthIndicator} with the specified name.
* @param name the name of the health indicator
* @param indicator the health indicator to add
* @return this instance
* @throws IllegalStateException if an indicator with the given {@code name} is
* already registered.
* @deprecated since 2.1.0 in favor of
* {@link ReactiveHealthIndicatorRegistry#register(String, ReactiveHealthIndicator)}
*/
@Deprecated
public CompositeReactiveHealthIndicator addHealthIndicator(String name,
ReactiveHealthIndicator indicator) {
this.registry.register(name, indicator);
return this;
}
/** /**
* Specify an alternative timeout {@link Health} if a {@link HealthIndicator} failed * Specify an alternative timeout {@link Health} if a {@link HealthIndicator} failed
* to reply after specified {@code timeout}. * to reply after specified {@code timeout}.
......
/*
* 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));
}
}
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -48,20 +48,6 @@ public class MetricsWebFilter implements WebFilter { ...@@ -48,20 +48,6 @@ public class MetricsWebFilter implements WebFilter {
private final boolean autoTimeRequests; private final boolean autoTimeRequests;
/**
* Create a new {@code MetricsWebFilter}.
* @param registry the registry to which metrics are recorded
* @param tagsProvider provider for metrics tags
* @param metricName name of the metric to record
* @deprecated since 2.0.6 in favor of
* {@link #MetricsWebFilter(MeterRegistry, WebFluxTagsProvider, String, boolean)}
*/
@Deprecated
public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider,
String metricName) {
this(registry, tagsProvider, metricName, true);
}
public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider,
String metricName, boolean autoTimeRequests) { String metricName, boolean autoTimeRequests) {
this.registry = registry; this.registry = registry;
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -34,7 +34,6 @@ import io.micrometer.core.instrument.Timer; ...@@ -34,7 +34,6 @@ import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.Timer.Builder; import io.micrometer.core.instrument.Timer.Builder;
import io.micrometer.core.instrument.Timer.Sample; import io.micrometer.core.instrument.Timer.Sample;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
...@@ -61,23 +60,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter { ...@@ -61,23 +60,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
private final boolean autoTimeRequests; private final boolean autoTimeRequests;
/**
* Create a new {@link WebMvcMetricsFilter} instance.
* @param context the source application context
* @param registry the meter registry
* @param tagsProvider the tags provider
* @param metricName the metric name
* @param autoTimeRequests if requests should be automatically timed
* @deprecated since 2.0.7 in favor of
* {@link #WebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, boolean)}
*/
@Deprecated
public WebMvcMetricsFilter(ApplicationContext context, MeterRegistry registry,
WebMvcTagsProvider tagsProvider, String metricName,
boolean autoTimeRequests) {
this(registry, tagsProvider, metricName, autoTimeRequests);
}
/** /**
* Create a new {@link WebMvcMetricsFilter} instance. * Create a new {@link WebMvcMetricsFilter} instance.
* @param registry the meter registry * @param registry the meter registry
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -55,18 +55,6 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { ...@@ -55,18 +55,6 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator {
this.threshold = threshold; this.threshold = threshold;
} }
/**
* Create a new {@code DiskSpaceHealthIndicator} instance.
* @param path the Path used to compute the available disk space
* @param threshold the minimum disk space that should be available (in bytes)
* @deprecated since 2.1.0 in favor of
* {@link #DiskSpaceHealthIndicator(File, DataSize)}
*/
@Deprecated
public DiskSpaceHealthIndicator(File path, long threshold) {
this(path, DataSize.ofBytes(threshold));
}
@Override @Override
protected void doHealthCheck(Health.Builder builder) throws Exception { protected void doHealthCheck(Health.Builder builder) throws Exception {
long diskFreeInBytes = this.path.getUsableSpace(); long diskFreeInBytes = this.path.getUsableSpace();
......
/*
* 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.HashMap;
import java.util.Map;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link CompositeHealthIndicatorFactory}.
*
* @author Phillip Webb
* @author Christian Dupuis
* @author Andy Wilkinson
*/
@Deprecated
public class CompositeHealthIndicatorFactoryTests {
@Test
public void upAndUpIsAggregatedToUp() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build());
healthIndicators.put("upAgain",
() -> new Health.Builder().status(Status.UP).build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
}
@Test
public void upAndDownIsAggregatedToDown() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build());
healthIndicators.put("down",
() -> new Health.Builder().status(Status.DOWN).build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.DOWN);
}
@Test
public void unknownStatusMapsToUnknown() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("status", () -> new Health.Builder().status("FINE").build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UNKNOWN);
}
private HealthIndicator createHealthIndicator(
Map<String, HealthIndicator> healthIndicators) {
return new CompositeHealthIndicatorFactory()
.createHealthIndicator(new OrderedHealthAggregator(), healthIndicators);
}
}
/*
* 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);
}
}
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -24,7 +24,6 @@ import java.util.List; ...@@ -24,7 +24,6 @@ import java.util.List;
import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.convert.DurationUnit;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -831,17 +830,6 @@ public class RabbitProperties { ...@@ -831,17 +830,6 @@ public class RabbitProperties {
this.defaultReceiveQueue = defaultReceiveQueue; 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 { public static class Retry {
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -93,23 +93,6 @@ public class JobLauncherCommandLineRunner ...@@ -93,23 +93,6 @@ public class JobLauncherCommandLineRunner
private ApplicationEventPublisher publisher; private ApplicationEventPublisher publisher;
/**
* Create a new {@link JobLauncherCommandLineRunner}.
* @param jobLauncher to launch jobs
* @param jobExplorer to check the job repository for previous executions
* @deprecated since 2.0.7 in favor of
* {@link #JobLauncherCommandLineRunner(JobLauncher, JobExplorer, JobRepository)}. A
* job repository is required to check if a job instance exists with the given
* parameters when running a job (which is not possible with the job explorer).
*/
@Deprecated
public JobLauncherCommandLineRunner(JobLauncher jobLauncher,
JobExplorer jobExplorer) {
this.jobLauncher = jobLauncher;
this.jobExplorer = jobExplorer;
this.jobRepository = null;
}
/** /**
* Create a new {@link JobLauncherCommandLineRunner}. * Create a new {@link JobLauncherCommandLineRunner}.
* @param jobLauncher to launch jobs * @param jobLauncher to launch jobs
......
...@@ -23,7 +23,6 @@ import com.datastax.driver.core.PoolingOptions; ...@@ -23,7 +23,6 @@ import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.QueryOptions; import com.datastax.driver.core.QueryOptions;
import com.datastax.driver.core.SocketOptions; import com.datastax.driver.core.SocketOptions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
...@@ -60,14 +59,8 @@ public class CassandraAutoConfiguration { ...@@ -60,14 +59,8 @@ public class CassandraAutoConfiguration {
map.from(properties::getUsername).whenNonNull().to((username) -> builder map.from(properties::getUsername).whenNonNull().to((username) -> builder
.withCredentials(username, properties.getPassword())); .withCredentials(username, properties.getPassword()));
map.from(properties::getCompression).whenNonNull().to(builder::withCompression); map.from(properties::getCompression).whenNonNull().to(builder::withCompression);
map.from(properties::getLoadBalancingPolicy).whenNonNull()
.as(BeanUtils::instantiateClass).to(builder::withLoadBalancingPolicy);
QueryOptions queryOptions = getQueryOptions(properties); QueryOptions queryOptions = getQueryOptions(properties);
map.from(queryOptions).to(builder::withQueryOptions); 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); SocketOptions socketOptions = getSocketOptions(properties);
map.from(socketOptions).to(builder::withSocketOptions); map.from(socketOptions).to(builder::withSocketOptions);
map.from(properties::isSsl).whenTrue().toCall(builder::withSSL); map.from(properties::isSsl).whenTrue().toCall(builder::withSSL);
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,12 +26,8 @@ import com.datastax.driver.core.ConsistencyLevel; ...@@ -26,12 +26,8 @@ import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.ProtocolOptions; import com.datastax.driver.core.ProtocolOptions;
import com.datastax.driver.core.ProtocolOptions.Compression; import com.datastax.driver.core.ProtocolOptions.Compression;
import com.datastax.driver.core.QueryOptions; 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.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.convert.DurationUnit;
/** /**
...@@ -82,11 +78,6 @@ public class CassandraProperties { ...@@ -82,11 +78,6 @@ public class CassandraProperties {
*/ */
private Compression compression = Compression.NONE; 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. * Queries consistency level.
*/ */
...@@ -102,16 +93,6 @@ public class CassandraProperties { ...@@ -102,16 +93,6 @@ public class CassandraProperties {
*/ */
private int fetchSize = QueryOptions.DEFAULT_FETCH_SIZE; 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. * Socket option: connection time out.
*/ */
...@@ -195,18 +176,6 @@ public class CassandraProperties { ...@@ -195,18 +176,6 @@ public class CassandraProperties {
this.compression = compression; 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() { public ConsistencyLevel getConsistencyLevel() {
return this.consistencyLevel; return this.consistencyLevel;
} }
...@@ -231,29 +200,6 @@ public class CassandraProperties { ...@@ -231,29 +200,6 @@ public class CassandraProperties {
this.fetchSize = fetchSize; 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() { public Duration getConnectTimeout() {
return this.connectTimeout; return this.connectTimeout;
} }
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
package org.springframework.boot.autoconfigure.influx; package org.springframework.boot.autoconfigure.influx;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.influxdb.InfluxDB; import org.influxdb.InfluxDB;
import org.influxdb.impl.InfluxDBImpl; import org.influxdb.impl.InfluxDBImpl;
...@@ -44,33 +42,20 @@ import org.springframework.context.annotation.Configuration; ...@@ -44,33 +42,20 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties(InfluxDbProperties.class) @EnableConfigurationProperties(InfluxDbProperties.class)
public class InfluxDbAutoConfiguration { public class InfluxDbAutoConfiguration {
private static final Log logger = LogFactory.getLog(InfluxDbAutoConfiguration.class);
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@ConditionalOnProperty("spring.influx.url") @ConditionalOnProperty("spring.influx.url")
public InfluxDB influxDb(InfluxDbProperties properties, public InfluxDB influxDb(InfluxDbProperties properties,
ObjectProvider<InfluxDbOkHttpClientBuilderProvider> builder, ObjectProvider<InfluxDbOkHttpClientBuilderProvider> builder) {
ObjectProvider<OkHttpClient.Builder> deprecatedBuilder) {
return new InfluxDBImpl(properties.getUrl(), properties.getUser(), return new InfluxDBImpl(properties.getUrl(), properties.getUser(),
properties.getPassword(), determineBuilder(builder.getIfAvailable(), properties.getPassword(), determineBuilder(builder.getIfAvailable()));
deprecatedBuilder.getIfAvailable()));
} }
@Deprecated
private static OkHttpClient.Builder determineBuilder( private static OkHttpClient.Builder determineBuilder(
InfluxDbOkHttpClientBuilderProvider builder, InfluxDbOkHttpClientBuilderProvider builder) {
OkHttpClient.Builder deprecatedBuilder) {
if (builder != null) { if (builder != null) {
return builder.get(); 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(); return new OkHttpClient.Builder();
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -110,17 +110,6 @@ public class JmsPoolConnectionFactoryProperties { ...@@ -110,17 +110,6 @@ public class JmsPoolConnectionFactoryProperties {
this.maxConnections = maxConnections; this.maxConnections = maxConnections;
} }
@Deprecated
public int getMaximumActiveSessionPerConnection() {
return getMaxSessionsPerConnection();
}
@Deprecated
public void setMaximumActiveSessionPerConnection(
int maximumActiveSessionPerConnection) {
setMaxSessionsPerConnection(maximumActiveSessionPerConnection);
}
public int getMaxSessionsPerConnection() { public int getMaxSessionsPerConnection() {
return this.maxSessionsPerConnection; return this.maxSessionsPerConnection;
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; ...@@ -33,7 +33,6 @@ import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer; import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.boot.context.properties.ConfigurationProperties; 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.context.properties.PropertyMapper;
import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.convert.DurationUnit;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -729,20 +728,6 @@ public class KafkaProperties { ...@@ -729,20 +728,6 @@ public class KafkaProperties {
this.bootstrapServers = bootstrapServers; 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() { public DataSize getCacheMaxSizeBuffering() {
return this.cacheMaxSizeBuffering; return this.cacheMaxSizeBuffering;
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -161,16 +161,6 @@ public class OAuth2ClientProperties { ...@@ -161,16 +161,6 @@ public class OAuth2ClientProperties {
this.redirectUri = redirectUri; this.redirectUri = redirectUri;
} }
@Deprecated
public String getRedirectUriTemplate() {
return getRedirectUri();
}
@Deprecated
public void setRedirectUriTemplate(String redirectUri) {
setRedirectUri(redirectUri);
}
public Set<String> getScope() { public Set<String> getScope() {
return this.scope; return this.scope;
} }
......
...@@ -30,7 +30,6 @@ import java.util.Map; ...@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import org.springframework.boot.context.properties.ConfigurationProperties; 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.context.properties.NestedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.convert.DurationUnit;
import org.springframework.boot.web.server.Compression; import org.springframework.boot.web.server.Compression;
...@@ -330,11 +329,6 @@ public class ServerProperties { ...@@ -330,11 +329,6 @@ public class ServerProperties {
*/ */
private DataSize maxHttpPostSize = DataSize.ofMegabytes(2); 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. * Maximum amount of request body to swallow.
*/ */
...@@ -504,17 +498,6 @@ public class ServerProperties { ...@@ -504,17 +498,6 @@ public class ServerProperties {
this.maxConnections = maxConnections; 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() { public DataSize getMaxSwallowSize() {
return this.maxSwallowSize; return this.maxSwallowSize;
} }
......
...@@ -85,7 +85,7 @@ public class TomcatWebServerFactoryCustomizer implements ...@@ -85,7 +85,7 @@ public class TomcatWebServerFactoryCustomizer implements
tomcatProperties.getMaxThreads())); tomcatProperties.getMaxThreads()));
propertyMapper.from(tomcatProperties::getMinSpareThreads).when(this::isPositive) propertyMapper.from(tomcatProperties::getMinSpareThreads).when(this::isPositive)
.to((minSpareThreads) -> customizeMinThreads(factory, minSpareThreads)); .to((minSpareThreads) -> customizeMinThreads(factory, minSpareThreads));
propertyMapper.from(this::determineMaxHttpHeaderSize).whenNonNull() propertyMapper.from(this.serverProperties.getMaxHttpHeaderSize()).whenNonNull()
.asInt(DataSize::toBytes).when(this::isPositive) .asInt(DataSize::toBytes).when(this::isPositive)
.to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory, .to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory,
maxHttpHeaderSize)); maxHttpHeaderSize));
...@@ -118,13 +118,6 @@ public class TomcatWebServerFactoryCustomizer implements ...@@ -118,13 +118,6 @@ public class TomcatWebServerFactoryCustomizer implements
return value > 0; 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, private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
int acceptCount) { int acceptCount) {
factory.addConnectorCustomizers((connector) -> { factory.addConnectorCustomizers((connector) -> {
......
/*
* 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.autoconfigure.web.servlet;
import org.springframework.web.servlet.DispatcherServlet;
/**
* Interface that provides the paths that the {@link DispatcherServlet} in an application
* context is mapped to.
*
* @author Madhura Bhave
* @since 2.0.2
* @deprecated since 2.0.4 in favor of {@link DispatcherServletPath} and
* {@link DispatcherServletRegistrationBean}
*/
@Deprecated
@FunctionalInterface
public interface DispatcherServletPathProvider {
String getServletPath();
}
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -325,18 +325,6 @@ public class RabbitAutoConfigurationTests { ...@@ -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 @Test
public void testRabbitTemplateMandatory() { public void testRabbitTemplateMandatory() {
this.contextRunner.withUserConfiguration(TestConfiguration.class) this.contextRunner.withUserConfiguration(TestConfiguration.class)
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -87,35 +87,6 @@ public class InfluxDbAutoConfigurationTests { ...@@ -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) { private int getReadTimeoutProperty(AssertableApplicationContext context) {
InfluxDB influxDB = context.getBean(InfluxDB.class); InfluxDB influxDB = context.getBean(InfluxDB.class);
Retrofit retrofit = (Retrofit) ReflectionTestUtils.getField(influxDB, "retrofit"); Retrofit retrofit = (Retrofit) ReflectionTestUtils.getField(influxDB, "retrofit");
...@@ -133,14 +104,4 @@ public class InfluxDbAutoConfigurationTests { ...@@ -133,14 +104,4 @@ public class InfluxDbAutoConfigurationTests {
} }
@Configuration
static class CustomOkHttpClientBuilderConfig {
@Bean
public OkHttpClient.Builder builder() {
return new OkHttpClient.Builder().readTimeout(30, TimeUnit.SECONDS);
}
}
} }
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -217,22 +217,6 @@ public class ActiveMQAutoConfigurationTests { ...@@ -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 @Test
public void poolConnectionFactoryConfiguration() { public void poolConnectionFactoryConfiguration() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class) this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
......
...@@ -401,21 +401,6 @@ public class ArtemisAutoConfigurationTests { ...@@ -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 @Test
public void poolConnectionFactoryConfiguration() { public void poolConnectionFactoryConfiguration() {
this.contextRunner.withPropertyValues("spring.artemis.pool.enabled:true") this.contextRunner.withPropertyValues("spring.artemis.pool.enabled:true")
......
...@@ -351,22 +351,6 @@ public class KafkaAutoConfigurationTests { ...@@ -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 @Test
public void streamsApplicationIdUsesMainApplicationNameByDefault() { public void streamsApplicationIdUsesMainApplicationNameByDefault() {
this.contextRunner.withUserConfiguration(EnableKafkaStreamsConfiguration.class) this.contextRunner.withUserConfiguration(EnableKafkaStreamsConfiguration.class)
......
...@@ -145,16 +145,6 @@ public class TomcatWebServerFactoryCustomizerTests { ...@@ -145,16 +145,6 @@ public class TomcatWebServerFactoryCustomizerTests {
.isEqualTo(DataSize.ofKilobytes(8).toBytes())); .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 @Test
public void customMaxSwallowSize() { public void customMaxSwallowSize() {
bind("server.tomcat.max-swallow-size=10MB"); bind("server.tomcat.max-swallow-size=10MB");
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -370,20 +370,6 @@ public class RestTemplateBuilder { ...@@ -370,20 +370,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Add HTTP basic authentication to requests. See
* {@link BasicAuthenticationInterceptor} for details.
* @param username the user name
* @param password the password
* @return a new builder instance
* @deprecated since 2.1.0 in favor of
* {@link #basicAuthentication(String username, String password)}
*/
@Deprecated
public RestTemplateBuilder basicAuthorization(String username, String password) {
return basicAuthentication(username, password);
}
/** /**
* Add HTTP basic authentication to requests. See * Add HTTP basic authentication to requests. See
* {@link BasicAuthenticationInterceptor} for details. * {@link BasicAuthenticationInterceptor} for details.
...@@ -486,18 +472,6 @@ public class RestTemplateBuilder { ...@@ -486,18 +472,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Sets the connection timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
* @param connectTimeout the connection timeout in milliseconds
* @return a new builder instance.
* @deprecated since 2.1.0 in favor of {@link #setConnectTimeout(Duration)}
*/
@Deprecated
public RestTemplateBuilder setConnectTimeout(int connectTimeout) {
return setConnectTimeout(Duration.ofMillis(connectTimeout));
}
/** /**
* Sets the read timeout on the underlying {@link ClientHttpRequestFactory}. * Sets the read timeout on the underlying {@link ClientHttpRequestFactory}.
* @param readTimeout the read timeout * @param readTimeout the read timeout
...@@ -513,18 +487,6 @@ public class RestTemplateBuilder { ...@@ -513,18 +487,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Sets the read timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
* @param readTimeout the read timeout in milliseconds
* @return a new builder instance.
* @deprecated since 2.1.0 in favor of {@link #setReadTimeout(Duration)}
*/
@Deprecated
public RestTemplateBuilder setReadTimeout(int readTimeout) {
return setReadTimeout(Duration.ofMillis(readTimeout));
}
/** /**
* Build a new {@link RestTemplate} instance and configure it using this builder. * Build a new {@link RestTemplate} instance and configure it using this builder.
* @return a configured {@link RestTemplate} instance. * @return a configured {@link RestTemplate} instance.
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -44,14 +44,6 @@ import org.springframework.util.StringUtils; ...@@ -44,14 +44,6 @@ import org.springframework.util.StringUtils;
public abstract class AbstractFilterRegistrationBean<T extends Filter> public abstract class AbstractFilterRegistrationBean<T extends Filter>
extends DynamicRegistrationBean<Dynamic> { extends DynamicRegistrationBean<Dynamic> {
/**
* Filters that wrap the servlet request should be ordered less than or equal to this.
* @deprecated since 2.1.0 in favor of
* {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER}
*/
@Deprecated
protected static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = 0;
private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; private static final String[] DEFAULT_URL_MAPPINGS = { "/*" };
private Set<ServletRegistrationBean<?>> servletRegistrationBeans = new LinkedHashSet<>(); private Set<ServletRegistrationBean<?>> servletRegistrationBeans = new LinkedHashSet<>();
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -43,14 +43,6 @@ import org.springframework.util.Assert; ...@@ -43,14 +43,6 @@ import org.springframework.util.Assert;
public class FilterRegistrationBean<T extends Filter> public class FilterRegistrationBean<T extends Filter>
extends AbstractFilterRegistrationBean<T> { extends AbstractFilterRegistrationBean<T> {
/**
* Filters that wrap the servlet request should be ordered less than or equal to this.
* @deprecated since 2.1.0 in favor of
* {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER}
*/
@Deprecated
public static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = AbstractFilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER;
private T filter; private T filter;
/** /**
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -54,27 +54,6 @@ public class MultipartConfigFactory { ...@@ -54,27 +54,6 @@ public class MultipartConfigFactory {
this.maxFileSize = maxFileSize; this.maxFileSize = maxFileSize;
} }
/**
* Sets the maximum size in bytes allowed for uploaded files.
* @param maxFileSize the maximum file size
* @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)}
*/
@Deprecated
public void setMaxFileSize(long maxFileSize) {
setMaxFileSize(DataSize.ofBytes(maxFileSize));
}
/**
* Sets the maximum size allowed for uploaded files. Values can use the suffixed "MB"
* or "KB" to indicate a Megabyte or Kilobyte size.
* @param maxFileSize the maximum file size
* @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)}
*/
@Deprecated
public void setMaxFileSize(String maxFileSize) {
setMaxFileSize(DataSize.parse(maxFileSize));
}
/** /**
* Sets the maximum {@link DataSize} allowed for multipart/form-data requests. * Sets the maximum {@link DataSize} allowed for multipart/form-data requests.
* @param maxRequestSize the maximum request size * @param maxRequestSize the maximum request size
...@@ -83,27 +62,6 @@ public class MultipartConfigFactory { ...@@ -83,27 +62,6 @@ public class MultipartConfigFactory {
this.maxRequestSize = maxRequestSize; this.maxRequestSize = maxRequestSize;
} }
/**
* Sets the maximum size allowed in bytes for multipart/form-data requests.
* @param maxRequestSize the maximum request size
* @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)}
*/
@Deprecated
public void setMaxRequestSize(long maxRequestSize) {
setMaxRequestSize(DataSize.ofBytes(maxRequestSize));
}
/**
* Sets the maximum size allowed for multipart/form-data requests. Values can use the
* suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
* @param maxRequestSize the maximum request size
* @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)}
*/
@Deprecated
public void setMaxRequestSize(String maxRequestSize) {
setMaxRequestSize(DataSize.parse(maxRequestSize));
}
/** /**
* Sets the {@link DataSize size} threshold after which files will be written to disk. * Sets the {@link DataSize size} threshold after which files will be written to disk.
* @param fileSizeThreshold the file size threshold * @param fileSizeThreshold the file size threshold
...@@ -112,27 +70,6 @@ public class MultipartConfigFactory { ...@@ -112,27 +70,6 @@ public class MultipartConfigFactory {
this.fileSizeThreshold = fileSizeThreshold; this.fileSizeThreshold = fileSizeThreshold;
} }
/**
* Sets the size threshold in bytes after which files will be written to disk.
* @param fileSizeThreshold the file size threshold
* @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)}
*/
@Deprecated
public void setFileSizeThreshold(int fileSizeThreshold) {
setFileSizeThreshold(DataSize.ofBytes(fileSizeThreshold));
}
/**
* Sets the size threshold after which files will be written to disk. Values can use
* the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
* @param fileSizeThreshold the file size threshold
* @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)}
*/
@Deprecated
public void setFileSizeThreshold(String fileSizeThreshold) {
setFileSizeThreshold(DataSize.parse(fileSizeThreshold));
}
/** /**
* Create a new {@link MultipartConfigElement} instance. * Create a new {@link MultipartConfigElement} instance.
* @return the multipart config element * @return the multipart config element
......
...@@ -332,16 +332,6 @@ public class RestTemplateBuilderTests { ...@@ -332,16 +332,6 @@ public class RestTemplateBuilderTests {
assertThat(interceptor).extracting("password").containsExactly("boot"); assertThat(interceptor).extracting("password").containsExactly("boot");
} }
@Test
@Deprecated
public void basicAuthorizationShouldApply() {
RestTemplate template = this.builder.basicAuthorization("spring", "boot").build();
ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0);
assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class);
assertThat(interceptor).extracting("username").containsExactly("spring");
assertThat(interceptor).extracting("password").containsExactly("boot");
}
@Test @Test
public void customizersWhenCustomizersAreNullShouldThrowException() { public void customizersWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
...@@ -554,24 +544,6 @@ public class RestTemplateBuilderTests { ...@@ -554,24 +544,6 @@ public class RestTemplateBuilderTests {
.isInstanceOf(BufferingClientHttpRequestFactory.class); .isInstanceOf(BufferingClientHttpRequestFactory.class);
} }
@Test
@SuppressWarnings("deprecation")
public void connectTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class)
.setConnectTimeout(1234).build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
}
@Test
@SuppressWarnings("deprecation")
public void readTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(1234)
.build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
}
public static class RestTemplateSubclass extends RestTemplate { public static class RestTemplateSubclass extends RestTemplate {
} }
......
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -42,34 +42,6 @@ public class MultipartConfigFactoryTests { ...@@ -42,34 +42,6 @@ public class MultipartConfigFactoryTests {
assertThat(config.getFileSizeThreshold()).isEqualTo(0); assertThat(config.getFileSizeThreshold()).isEqualTo(0);
} }
@Test
@Deprecated
public void create() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setLocation("loc");
factory.setMaxFileSize(1);
factory.setMaxRequestSize(2);
factory.setFileSizeThreshold(3);
MultipartConfigElement config = factory.createMultipartConfig();
assertThat(config.getLocation()).isEqualTo("loc");
assertThat(config.getMaxFileSize()).isEqualTo(1L);
assertThat(config.getMaxRequestSize()).isEqualTo(2L);
assertThat(config.getFileSizeThreshold()).isEqualTo(3);
}
@Test
@Deprecated
public void createWithStringSizes() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize("1");
factory.setMaxRequestSize("2KB");
factory.setFileSizeThreshold("3MB");
MultipartConfigElement config = factory.createMultipartConfig();
assertThat(config.getMaxFileSize()).isEqualTo(1L);
assertThat(config.getMaxRequestSize()).isEqualTo(2 * 1024L);
assertThat(config.getFileSizeThreshold()).isEqualTo(3 * 1024 * 1024);
}
@Test @Test
public void createWithDataSizes() { public void createWithDataSizes() {
MultipartConfigFactory factory = new MultipartConfigFactory(); MultipartConfigFactory factory = new MultipartConfigFactory();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment