From 8f102aee6862b92a8e4c5db7a30527db05a2b183 Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Tue, 14 Jan 2020 13:45:01 -0600 Subject: [PATCH] Remove deprecated 2.2 code See gh-19699 --- .../ConditionalOnEnabledEndpoint.java | 112 ------- .../condition/OnEnabledEndpointCondition.java | 40 --- .../ConditionalOnEnabledEndpointTests.java | 277 ------------------ .../endpoint/http/ActuatorMediaType.java | 9 +- .../autoconfigure/amqp/RabbitProperties.java | 36 +-- .../batch/JobLauncherCommandLineRunner.java | 49 ---- .../autoconfigure/orm/jpa/JpaProperties.java | 20 +- .../amqp/RabbitAutoConfigurationTests.java | 25 +- .../amqp/RabbitPropertiesTests.java | 23 +- .../orm/jpa/JpaPropertiesTests.java | 138 --------- .../WebTestClientBuilderCustomizer.java | 37 --- .../boot/test/rule/OutputCapture.java | 69 ----- .../boot/test/system/OutputCaptureRule.java | 11 +- .../boot/test/rule/OutputCaptureTests.java | 49 ---- .../boot/maven/AbstractRunMojo.java | 36 +-- .../springframework/boot/maven/RunMojo.java | 8 +- .../springframework/boot/ansi/AnsiColors.java | 13 +- .../ConfigurationBeanFactoryMetadata.java | 93 ------ ...urationPropertiesBindingPostProcessor.java | 20 +- ...opertiesBindingPostProcessorRegistrar.java | 46 --- ...nableConfigurationPropertiesRegistrar.java | 3 +- .../context/properties/bind/BindResult.java | 16 +- ...onConfigReactiveWebApplicationContext.java | 234 +-------------- .../ReactiveWebServerApplicationContext.java | 15 +- .../ConfigurationPropertiesTests.java | 3 +- .../properties/bind/BindResultTests.java | 25 +- 26 files changed, 20 insertions(+), 1387 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpoint.java delete mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java delete mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java delete mode 100644 spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java delete mode 100644 spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java delete mode 100644 spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java delete mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpoint.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpoint.java deleted file mode 100644 index 8dc4bdb561..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpoint.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.endpoint.condition; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.boot.actuate.endpoint.annotation.Endpoint; -import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension; -import org.springframework.context.annotation.Conditional; -import org.springframework.core.env.Environment; - -/** - * {@link Conditional @Conditional} that checks whether an endpoint is enabled or not. - * Matches according to the endpoints specific {@link Environment} property, falling back - * to {@code management.endpoints.enabled-by-default} or failing that - * {@link Endpoint#enableByDefault()}. - *

- * When placed on a {@code @Bean} method, the endpoint defaults to the return type of the - * factory method: - * - *

- * @Configuration
- * public class MyConfiguration {
- *
- *     @ConditionalOnEnableEndpoint
- *     @Bean
- *     public MyEndpoint myEndpoint() {
- *         ...
- *     }
- *
- * }
- *

- * It is also possible to use the same mechanism for extensions: - * - *

- * @Configuration
- * public class MyConfiguration {
- *
- *     @ConditionalOnEnableEndpoint
- *     @Bean
- *     public MyEndpointWebExtension myEndpointWebExtension() {
- *         ...
- *     }
- *
- * }
- *

- * In the sample above, {@code MyEndpointWebExtension} will be created if the endpoint is - * enabled as defined by the rules above. {@code MyEndpointWebExtension} must be a regular - * extension that refers to an endpoint, something like: - * - *

- * @EndpointWebExtension(endpoint = MyEndpoint.class)
- * public class MyEndpointWebExtension {
- *
- * }
- *

- * Alternatively, the target endpoint can be manually specified for components that should - * only be created when a given endpoint is enabled: - * - *

- * @Configuration
- * public class MyConfiguration {
- *
- *     @ConditionalOnEnableEndpoint(endpoint = MyEndpoint.class)
- *     @Bean
- *     public MyComponent myComponent() {
- *         ...
- *     }
- *
- * }
- * - * @author Stephane Nicoll - * @since 2.0.0 - * @see Endpoint - * @deprecated as of 2.2.0 in favor of - * {@link ConditionalOnAvailableEndpoint @ConditionalOnAvailableEndpoint} - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.METHOD, ElementType.TYPE }) -@Documented -@Conditional(OnEnabledEndpointCondition.class) -@Deprecated -public @interface ConditionalOnEnabledEndpoint { - - /** - * The endpoint type that should be checked. Inferred when the return type of the - * {@code @Bean} method is either an {@link Endpoint @Endpoint} or an - * {@link EndpointExtension @EndpointExtension}. - * @return the endpoint type to check - * @since 2.0.6 - */ - Class endpoint() default Void.class; - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java deleted file mode 100644 index 2babd17f14..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.endpoint.condition; - -import org.springframework.boot.autoconfigure.condition.ConditionOutcome; -import org.springframework.context.annotation.ConditionContext; -import org.springframework.core.type.AnnotatedTypeMetadata; - -/** - * A condition that checks if an endpoint is enabled. - * - * @author Stephane Nicoll - * @author Andy Wilkinson - * @author Phillip Webb - * @see ConditionalOnEnabledEndpoint - * @deprecated as of 2.2.0 in favor of {@link OnAvailableEndpointCondition} - */ -@Deprecated -class OnEnabledEndpointCondition extends AbstractEndpointCondition { - - @Override - public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - return getEnablementOutcome(context, metadata, ConditionalOnEnabledEndpoint.class); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java deleted file mode 100644 index 98a66fcc5a..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.endpoint.condition; - -import org.junit.jupiter.api.Test; - -import org.springframework.boot.actuate.endpoint.EndpointFilter; -import org.springframework.boot.actuate.endpoint.ExposableEndpoint; -import org.springframework.boot.actuate.endpoint.annotation.Endpoint; -import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link ConditionalOnEnabledEndpoint @ConditionalOnEnabledEndpoint}. - * - * @author Stephane Nicoll - * @author Andy Wilkinson - */ -@Deprecated -@SuppressWarnings("deprecation") -class ConditionalOnEnabledEndpointTests { - - private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); - - @Test - void outcomeWhenEndpointEnabledPropertyIsTrueShouldMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=true") - .withUserConfiguration(FooEndpointEnabledByDefaultFalseConfiguration.class) - .run((context) -> assertThat(context).hasBean("foo")); - } - - @Test - void outcomeWhenEndpointEnabledPropertyIsFalseShouldNotMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=false") - .withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("foo")); - } - - @Test - void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsTrueShouldMatch() { - this.contextRunner.withPropertyValues("management.endpoints.enabled-by-default=true") - .withUserConfiguration(FooEndpointEnabledByDefaultFalseConfiguration.class) - .run((context) -> assertThat(context).hasBean("foo")); - } - - @Test - void outcomeWhenNoEndpointPropertyAndUserDefinedDefaultIsFalseShouldNotMatch() { - this.contextRunner.withPropertyValues("management.endpoints.enabled-by-default=false") - .withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("foo")); - } - - @Test - void outcomeWhenNoPropertiesAndAnnotationIsEnabledByDefaultShouldMatch() { - this.contextRunner.withUserConfiguration(FooEndpointEnabledByDefaultTrueConfiguration.class) - .run((context) -> assertThat(context).hasBean("foo")); - } - - @Test - void outcomeWhenNoPropertiesAndAnnotationIsNotEnabledByDefaultShouldNotMatch() { - this.contextRunner.withUserConfiguration(FooEndpointEnabledByDefaultFalseConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("foo")); - } - - @Test - void outcomeWhenNoPropertiesAndExtensionAnnotationIsEnabledByDefaultShouldMatch() { - this.contextRunner.withUserConfiguration(FooEndpointAndExtensionEnabledByDefaultTrueConfiguration.class) - .run((context) -> assertThat(context).hasBean("foo").hasBean("fooExt")); - } - - @Test - void outcomeWhenNoPropertiesAndExtensionAnnotationIsNotEnabledByDefaultShouldNotMatch() { - this.contextRunner.withUserConfiguration(FooEndpointAndExtensionEnabledByDefaultFalseConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("foo").doesNotHaveBean("fooExt")); - } - - @Test - void outcomeWithReferenceWhenNoPropertiesShouldMatch() { - this.contextRunner - .withUserConfiguration(FooEndpointEnabledByDefaultTrue.class, - ComponentEnabledIfEndpointIsEnabledConfiguration.class) - .run((context) -> assertThat(context).hasBean("fooComponent")); - } - - @Test - void outcomeWithReferenceWhenEndpointEnabledPropertyIsTrueShouldMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=true") - .withUserConfiguration(FooEndpointEnabledByDefaultTrue.class, - ComponentEnabledIfEndpointIsEnabledConfiguration.class) - .run((context) -> assertThat(context).hasBean("fooComponent")); - } - - @Test - void outcomeWithReferenceWhenEndpointEnabledPropertyIsFalseShouldNotMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=false") - .withUserConfiguration(FooEndpointEnabledByDefaultTrue.class, - ComponentEnabledIfEndpointIsEnabledConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("fooComponent")); - } - - @Test - void outcomeWithNoReferenceShouldFail() { - this.contextRunner.withUserConfiguration(ComponentWithNoEndpointReferenceConfiguration.class).run((context) -> { - assertThat(context).hasFailed(); - assertThat(context.getStartupFailure().getCause().getMessage()) - .contains("No endpoint is specified and the return type of the @Bean method " - + "is neither an @Endpoint, nor an @EndpointExtension"); - }); - } - - @Test - void outcomeWhenEndpointEnabledPropertyIsTrueAndMixedCaseShouldMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo-bar.enabled=true") - .withUserConfiguration(FooBarEndpointEnabledByDefaultFalseConfiguration.class) - .run((context) -> assertThat(context).hasBean("fooBar")); - } - - @Test - void outcomeWhenEndpointEnabledPropertyIsFalseOnClassShouldNotMatch() { - this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=false") - .withUserConfiguration(FooEndpointEnabledByDefaultTrueOnConfigurationConfiguration.class) - .run((context) -> assertThat(context).doesNotHaveBean("foo")); - } - - @Endpoint(id = "foo", enableByDefault = true) - static class FooEndpointEnabledByDefaultTrue { - - } - - @Endpoint(id = "foo", enableByDefault = false) - static class FooEndpointEnabledByDefaultFalse { - - } - - @Endpoint(id = "fooBar", enableByDefault = false) - static class FooBarEndpointEnabledByDefaultFalse { - - } - - @EndpointExtension(endpoint = FooEndpointEnabledByDefaultTrue.class, filter = TestFilter.class) - static class FooEndpointExtensionEnabledByDefaultTrue { - - } - - @EndpointExtension(endpoint = FooEndpointEnabledByDefaultFalse.class, filter = TestFilter.class) - static class FooEndpointExtensionEnabledByDefaultFalse { - - } - - static class TestFilter implements EndpointFilter> { - - @Override - public boolean match(ExposableEndpoint endpoint) { - return true; - } - - } - - @Configuration(proxyBeanMethods = false) - static class FooEndpointEnabledByDefaultTrueConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointEnabledByDefaultTrue foo() { - return new FooEndpointEnabledByDefaultTrue(); - } - - } - - @Configuration(proxyBeanMethods = false) - @ConditionalOnEnabledEndpoint(endpoint = FooEndpointEnabledByDefaultTrue.class) - static class FooEndpointEnabledByDefaultTrueOnConfigurationConfiguration { - - @Bean - FooEndpointEnabledByDefaultTrue foo() { - return new FooEndpointEnabledByDefaultTrue(); - } - - } - - @Configuration(proxyBeanMethods = false) - static class FooEndpointEnabledByDefaultFalseConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointEnabledByDefaultFalse foo() { - return new FooEndpointEnabledByDefaultFalse(); - } - - } - - @Configuration(proxyBeanMethods = false) - static class FooBarEndpointEnabledByDefaultFalseConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - FooBarEndpointEnabledByDefaultFalse fooBar() { - return new FooBarEndpointEnabledByDefaultFalse(); - } - - } - - @Configuration(proxyBeanMethods = false) - static class FooEndpointAndExtensionEnabledByDefaultTrueConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointEnabledByDefaultTrue foo() { - return new FooEndpointEnabledByDefaultTrue(); - } - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointExtensionEnabledByDefaultTrue fooExt() { - return new FooEndpointExtensionEnabledByDefaultTrue(); - } - - } - - @Configuration(proxyBeanMethods = false) - static class FooEndpointAndExtensionEnabledByDefaultFalseConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointEnabledByDefaultFalse foo() { - return new FooEndpointEnabledByDefaultFalse(); - } - - @Bean - @ConditionalOnEnabledEndpoint - FooEndpointExtensionEnabledByDefaultFalse fooExt() { - return new FooEndpointExtensionEnabledByDefaultFalse(); - } - - } - - @Configuration(proxyBeanMethods = false) - static class ComponentEnabledIfEndpointIsEnabledConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint(endpoint = FooEndpointEnabledByDefaultTrue.class) - String fooComponent() { - return "foo"; - } - - } - - @Configuration(proxyBeanMethods = false) - static class ComponentWithNoEndpointReferenceConfiguration { - - @Bean - @ConditionalOnEnabledEndpoint - String fooComponent() { - return "foo"; - } - - } - -} diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ActuatorMediaType.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ActuatorMediaType.java index 831f4e0c4b..378e14f658 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ActuatorMediaType.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ActuatorMediaType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -25,13 +25,6 @@ package org.springframework.boot.actuate.endpoint.http; */ public final class ActuatorMediaType { - /** - * Constant for the Actuator V1 media type. - * @deprecated since 2.2.0 as the v1 format is no longer supported - */ - @Deprecated - public static final String V1_JSON = "application/vnd.spring-boot.actuator.v1+json"; - /** * Constant for the Actuator {@link ApiVersion#V2 v2} media type. */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 96f9c97fb3..d63b65483d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -25,7 +25,6 @@ import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.ConfirmType; 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; @@ -289,17 +288,6 @@ public class RabbitProperties { this.requestedChannelMax = requestedChannelMax; } - @DeprecatedConfigurationProperty(reason = "replaced to support additional confirm types", - replacement = "spring.rabbitmq.publisher-confirm-type") - public boolean isPublisherConfirms() { - return ConfirmType.CORRELATED.equals(this.publisherConfirmType); - } - - @Deprecated - public void setPublisherConfirms(boolean publisherConfirms) { - this.publisherConfirmType = (publisherConfirms) ? ConfirmType.CORRELATED : ConfirmType.NONE; - } - public boolean isPublisherReturns() { return this.publisherReturns; } @@ -732,28 +720,6 @@ public class RabbitProperties { this.maxConcurrency = maxConcurrency; } - /** - * Return the number of messages processed in one transaction. - * @return the number of messages - * @deprecated since 2.2.0 in favor of {@link SimpleContainer#getBatchSize()} - */ - @DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.batch-size") - @Deprecated - public Integer getTransactionSize() { - return getBatchSize(); - } - - /** - * Set the number of messages processed in one transaction. - * @param transactionSize the number of messages - * @deprecated since 2.2.0 in favor of - * {@link SimpleContainer#setBatchSize(Integer)} - */ - @Deprecated - public void setTransactionSize(Integer transactionSize) { - setBatchSize(transactionSize); - } - public Integer getBatchSize() { return this.batchSize; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java deleted file mode 100644 index 4b24806c72..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.batch; - -import org.springframework.batch.core.explore.JobExplorer; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.boot.ApplicationRunner; - -/** - * {@link ApplicationRunner} to {@link JobLauncher launch} Spring Batch jobs. Runs all - * jobs in the surrounding context by default. Can also be used to launch a specific job - * by providing a jobName - * - * @author Dave Syer - * @author Jean-Pierre Bergamin - * @author Mahmoud Ben Hassine - * @since 1.0.0 - * @deprecated since 2.2.0 in favor of {@link JobLauncherApplicationRunner} - */ -@Deprecated -public class JobLauncherCommandLineRunner extends JobLauncherApplicationRunner { - - /** - * Create a new {@link JobLauncherCommandLineRunner}. - * @param jobLauncher to launch jobs - * @param jobExplorer to check the job repository for previous executions - * @param jobRepository to check if a job instance exists with the given parameters - * when running a job - */ - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer, JobRepository jobRepository) { - super(jobLauncher, jobExplorer, jobRepository); - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java index 909496791f..9a208af28e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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,8 +21,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.sql.DataSource; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.orm.jpa.vendor.Database; @@ -129,20 +127,4 @@ public class JpaProperties { this.openInView = openInView; } - /** - * Determine the {@link Database} to use based on this configuration and the primary - * {@link DataSource}. - * @param dataSource the auto-configured data source - * @return {@code Database} - * @deprecated since 2.2.0 in favor of letting the JPA container detect the database - * to use. - */ - @Deprecated - public Database determineDatabase(DataSource dataSource) { - if (this.database != null) { - return this.database; - } - return DatabaseLookup.getDatabase(dataSource); - } - } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index ab80ca7500..00b79cffe9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -201,17 +201,6 @@ class RabbitAutoConfigurationTests { }); } - @Test - @Deprecated - void testConnectionFactoryPublisherConfirmTypeUsingDeprecatedProperty() { - this.contextRunner.withUserConfiguration(TestConfiguration.class) - .withPropertyValues("spring.rabbitmq.publisher-confirms=true").run((context) -> { - CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class); - assertThat(connectionFactory.isPublisherConfirms()).isTrue(); - assertThat(connectionFactory.isSimplePublisherConfirms()).isFalse(); - }); - } - @Test void testConnectionFactoryPublisherConfirmTypeCorrelated() { this.contextRunner.withUserConfiguration(TestConfiguration.class) @@ -459,18 +448,6 @@ class RabbitAutoConfigurationTests { }); } - @Test - @Deprecated - void testRabbitListenerContainerFactoryWithDeprecatedTransactionSizeStillWorks() { - this.contextRunner - .withUserConfiguration(MessageConvertersConfiguration.class, MessageRecoverersConfiguration.class) - .withPropertyValues("spring.rabbitmq.listener.simple.transactionSize:20").run((context) -> { - SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context - .getBean("rabbitListenerContainerFactory", SimpleRabbitListenerContainerFactory.class); - assertThat(rabbitListenerContainerFactory).hasFieldOrPropertyWithValue("batchSize", 20); - }); - } - @Test void testDirectRabbitListenerContainerFactoryWithCustomSettings() { this.contextRunner diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java index ac84b9ff60..e249973247 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; import org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; -import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer; import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; @@ -293,24 +292,4 @@ class RabbitPropertiesTests { assertThat(container).hasFieldOrPropertyWithValue("missingQueuesFatal", direct.isMissingQueuesFatal()); } - @Test - @Deprecated - void isPublisherConfirmsShouldDefaultToFalse() { - assertThat(this.properties.isPublisherConfirms()).isEqualTo(false); - } - - @Test - @Deprecated - void isPublisherConfirmsWhenPublisherConfirmsTypeSimpleShouldBeFalse() { - this.properties.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.SIMPLE); - assertThat(this.properties.isPublisherConfirms()).isEqualTo(false); - } - - @Test - @Deprecated - void isPublisherConfirmsWhenPublisherConfirmsTypeCorrelatedShouldBeTrue() { - this.properties.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED); - assertThat(this.properties.isPublisherConfirms()).isEqualTo(true); - } - } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java deleted file mode 100644 index 2453e9d985..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.orm.jpa; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.function.Consumer; - -import javax.sql.DataSource; - -import org.junit.jupiter.api.Test; - -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.assertj.AssertableApplicationContext; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.boot.test.context.runner.ContextConsumer; -import org.springframework.context.annotation.Configuration; -import org.springframework.orm.jpa.vendor.Database; - -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.verify; - -/** - * Tests for {@link JpaProperties}. - * - * @author Stephane Nicoll - */ -class JpaPropertiesTests { - - private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withUserConfiguration(TestConfiguration.class); - - @Test - @Deprecated - @SuppressWarnings("deprecation") - void determineDatabaseNoCheckIfDatabaseIsSet() { - this.contextRunner.withPropertyValues("spring.jpa.database=postgresql") - .run(assertJpaProperties((properties) -> { - DataSource dataSource = mockStandaloneDataSource(); - Database database = properties.determineDatabase(dataSource); - assertThat(database).isEqualTo(Database.POSTGRESQL); - try { - verify(dataSource, never()).getConnection(); - } - catch (SQLException ex) { - throw new IllegalStateException("Should not happen", ex); - } - })); - } - - @Test - @Deprecated - @SuppressWarnings("deprecation") - void determineDatabaseWithKnownUrl() { - this.contextRunner.run(assertJpaProperties((properties) -> { - Database database = properties.determineDatabase(mockDataSource("jdbc:h2:mem:testdb")); - assertThat(database).isEqualTo(Database.H2); - })); - } - - @Test - @Deprecated - @SuppressWarnings("deprecation") - void determineDatabaseWithKnownUrlAndUserConfig() { - this.contextRunner.withPropertyValues("spring.jpa.database=mysql").run(assertJpaProperties((properties) -> { - Database database = properties.determineDatabase(mockDataSource("jdbc:h2:mem:testdb")); - assertThat(database).isEqualTo(Database.MYSQL); - })); - } - - @Test - @Deprecated - @SuppressWarnings("deprecation") - void determineDatabaseWithUnknownUrl() { - this.contextRunner.run(assertJpaProperties((properties) -> { - Database database = properties.determineDatabase(mockDataSource("jdbc:unknown://localhost")); - assertThat(database).isEqualTo(Database.DEFAULT); - })); - } - - private DataSource mockStandaloneDataSource() { - try { - DataSource ds = mock(DataSource.class); - given(ds.getConnection()).willThrow(SQLException.class); - return ds; - } - catch (SQLException ex) { - throw new IllegalStateException("Should not happen", ex); - } - } - - private DataSource mockDataSource(String jdbcUrl) { - DataSource ds = mock(DataSource.class); - try { - DatabaseMetaData metadata = mock(DatabaseMetaData.class); - given(metadata.getURL()).willReturn(jdbcUrl); - Connection connection = mock(Connection.class); - given(connection.getMetaData()).willReturn(metadata); - given(ds.getConnection()).willReturn(connection); - } - catch (SQLException ex) { - // Do nothing - } - return ds; - } - - private ContextConsumer assertJpaProperties(Consumer consumer) { - return (context) -> { - assertThat(context).hasSingleBean(JpaProperties.class); - consumer.accept(context.getBean(JpaProperties.class)); - }; - } - - @Configuration(proxyBeanMethods = false) - @EnableConfigurationProperties(JpaProperties.class) - static class TestConfiguration { - - } - -} diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java deleted file mode 100644 index 750161e4d1..0000000000 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.test.autoconfigure.web.reactive; - -import org.springframework.test.web.reactive.server.WebTestClient.Builder; - -/** - * A customizer for a {@link Builder}. Any {@code WebTestClientBuilderCustomizer} beans - * found in the application context will be {@link #customize called} to customize the - * auto-configured {@link Builder}. - * - * @author Andy Wilkinson - * @since 2.0.0 - * @see WebTestClientAutoConfiguration - * @deprecated since 2.2 in favor of - * {@link org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer} - */ -@FunctionalInterface -@Deprecated -public interface WebTestClientBuilderCustomizer - extends org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer { - -} diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java deleted file mode 100644 index 1d4b1f31ed..0000000000 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.test.rule; - -import org.hamcrest.Matcher; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -import org.springframework.boot.test.system.OutputCaptureRule; - -/** - * JUnit {@code @Rule} to capture output from System.out and System.err. - * - * @author Phillip Webb - * @author Andy Wilkinson - * @since 1.4.0 - * @deprecated since 2.2.0 in favor of {@link OutputCaptureRule} - */ -@Deprecated -public class OutputCapture implements TestRule { - - private final OutputCaptureRule delegate = new OutputCaptureRule(); - - @Override - public Statement apply(Statement base, Description description) { - return this.delegate.apply(base, description); - } - - /** - * Discard all currently accumulated output. - */ - public void reset() { - this.delegate.reset(); - } - - public void flush() { - // Flushing is no longer necessary - } - - @Override - public String toString() { - return this.delegate.toString(); - } - - /** - * Verify that the output is matched by the supplied {@code matcher}. Verification is - * performed after the test method has executed. - * @param matcher the matcher - */ - public void expect(Matcher matcher) { - this.delegate.expect(matcher); - } - -} diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java index 4eccfebd27..4297fe33c8 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -81,15 +81,6 @@ public class OutputCaptureRule implements TestRule, CapturedOutput { }; } - /** - * Resets the current capture session, clearing its captured output. - * @deprecated since 2.2.0 with no replacement - */ - @Deprecated - public void reset() { - OutputCaptureRule.this.delegate.reset(); - } - @Override public String getAll() { return this.delegate.getAll(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java deleted file mode 100644 index 68d9774e5f..0000000000 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.test.rule; - -import org.junit.Rule; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link OutputCapture}. - * - * @author Roland Weisleder - */ -@Deprecated -public class OutputCaptureTests { - - @Rule - public OutputCapture outputCapture = new OutputCapture(); - - @Test - public void toStringShouldReturnAllCapturedOutput() { - System.out.println("Hello World"); - assertThat(this.outputCapture.toString()).contains("Hello World"); - } - - @Test - public void reset() { - System.out.println("Hello"); - this.outputCapture.reset(); - System.out.println("World"); - assertThat(this.outputCapture.toString()).doesNotContain("Hello").contains("World"); - } - -} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 7ff22e469f..9091fc4a3b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -94,15 +94,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { @Parameter(property = "spring-boot.run.addResources", defaultValue = "false") private boolean addResources = false; - /** - * Path to agent jar. NOTE: a forked process is required to use this feature. - * @since 1.0.0 - * @deprecated since 2.2.0 in favor of {@code agents} - */ - @Deprecated - @Parameter(property = "spring-boot.run.agent") - private File[] agent; - /** * Path to agent jars. NOTE: a forked process is required to use this feature. * @since 2.2.0 @@ -240,20 +231,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { return this.fork; } - /** - * Specify if fork should be enabled by default. - * @return {@code true} if fork should be enabled by default - * @see #logDisabledFork() - * @deprecated as of 2.2.0 in favour of enabling forking by default. - */ - @Deprecated - protected boolean enableForkByDefault() { - return hasAgent() || hasJvmArgs() || hasEnvVariables() || hasWorkingDirectorySet(); - } - private boolean hasAgent() { - File[] configuredAgents = determineAgents(); - return (configuredAgents != null && configuredAgents.length > 0); + return (this.agents != null && this.agents.length > 0); } private boolean hasJvmArgs() { @@ -398,12 +377,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } private void addAgents(List args) { - File[] configuredAgents = determineAgents(); - if (configuredAgents != null) { + if (this.agents != null) { if (getLog().isInfoEnabled()) { - getLog().info("Attaching agents: " + Arrays.asList(configuredAgents)); + getLog().info("Attaching agents: " + Arrays.asList(this.agents)); } - for (File agent : configuredAgents) { + for (File agent : this.agents) { args.add("-javaagent:" + agent); } } @@ -412,10 +390,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } } - private File[] determineAgents() { - return (this.agents != null) ? this.agents : this.agent; - } - private void addActiveProfileArgument(RunArguments arguments) { if (this.profiles.length > 0) { StringBuilder arg = new StringBuilder("--spring.profiles.active="); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 7b97246729..959dbc4872 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -62,12 +62,6 @@ public class RunMojo extends AbstractRunMojo { @Parameter(property = "spring-boot.run.optimizedLaunch", defaultValue = "true") private boolean optimizedLaunch; - @Override - @Deprecated - protected boolean enableForkByDefault() { - return super.enableForkByDefault() || hasDevtools(); - } - @Override protected void logDisabledFork() { super.logDisabledFork(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java index dc6384c1e0..24a8afcbec 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -130,17 +130,6 @@ public final class AnsiColors { return closest; } - /** - * Get the closest {@link AnsiColor ANSI color} to the given AWT {@link Color}. - * @param color the color to find - * @return the closest color - * @deprecated since 2.2.0 in favor of {@link #findClosest(Color)} - */ - @Deprecated - public static AnsiColor getClosest(Color color) { - return (AnsiColor) new AnsiColors(BitDepth.FOUR).findClosest(color); - } - /** * Represents a color stored in LAB form. */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java deleted file mode 100644 index 15df03eb30..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.context.properties; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.support.GenericBeanDefinition; -import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.annotation.AnnotationUtils; - -/** - * Utility class to memorize {@code @Bean} definition metadata during initialization of - * the bean factory. - * - * @author Dave Syer - * @since 1.1.0 - * @deprecated since 2.2.0 in favor of {@link ConfigurationPropertiesBean} - */ -@Deprecated -public class ConfigurationBeanFactoryMetadata implements ApplicationContextAware { - - /** - * The bean name that this class is registered with. - */ - public static final String BEAN_NAME = ConfigurationBeanFactoryMetadata.class.getName(); - - private ConfigurableApplicationContext applicationContext; - - public Map getBeansWithFactoryAnnotation(Class type) { - Map result = new HashMap<>(); - for (String name : this.applicationContext.getBeanFactory().getBeanDefinitionNames()) { - if (findFactoryAnnotation(name, type) != null) { - result.put(name, this.applicationContext.getBean(name)); - } - } - return result; - } - - public A findFactoryAnnotation(String beanName, Class type) { - Method method = findFactoryMethod(beanName); - return (method != null) ? AnnotationUtils.findAnnotation(method, type) : null; - } - - public Method findFactoryMethod(String beanName) { - ConfigurableListableBeanFactory beanFactory = this.applicationContext.getBeanFactory(); - if (beanFactory.containsBeanDefinition(beanName)) { - BeanDefinition beanDefinition = beanFactory.getMergedBeanDefinition(beanName); - if (beanDefinition instanceof RootBeanDefinition) { - return ((RootBeanDefinition) beanDefinition).getResolvedFactoryMethod(); - } - } - return null; - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = (ConfigurableApplicationContext) applicationContext; - } - - static void register(BeanDefinitionRegistry registry) { - if (!registry.containsBeanDefinition(BEAN_NAME)) { - GenericBeanDefinition definition = new GenericBeanDefinition(); - definition.setBeanClass(ConfigurationBeanFactoryMetadata.class); - definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); - registry.registerBeanDefinition(ConfigurationBeanFactoryMetadata.BEAN_NAME, definition); - } - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 102c677560..742078b655 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -49,30 +49,12 @@ public class ConfigurationPropertiesBindingPostProcessor */ public static final String BEAN_NAME = ConfigurationPropertiesBindingPostProcessor.class.getName(); - /** - * The bean name of the configuration properties validator. - * @deprecated since 2.2.0 in favor of - * {@link EnableConfigurationProperties#VALIDATOR_BEAN_NAME} - */ - @Deprecated - public static final String VALIDATOR_BEAN_NAME = EnableConfigurationProperties.VALIDATOR_BEAN_NAME; - private ApplicationContext applicationContext; private BeanDefinitionRegistry registry; private ConfigurationPropertiesBinder binder; - /** - * Create a new {@link ConfigurationPropertiesBindingPostProcessor} instance. - * @deprecated since 2.2.0 in favor of - * {@link EnableConfigurationProperties @EnableConfigurationProperties} or - * {@link ConfigurationPropertiesBindingPostProcessor#register(BeanDefinitionRegistry)} - */ - @Deprecated - public ConfigurationPropertiesBindingPostProcessor() { - } - @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java deleted file mode 100644 index 5d4a596333..0000000000 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.context.properties; - -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; -import org.springframework.core.type.AnnotationMetadata; - -/** - * {@link ImportBeanDefinitionRegistrar} for binding externalized application properties - * to {@link ConfigurationProperties @ConfigurationProperties} beans. - * - * @author Dave Syer - * @author Phillip Webb - * @since 1.0.0 - * @deprecated since 2.2.0 in favor of - * {@link EnableConfigurationProperties @EnableConfigurationProperties} - */ -@Deprecated -public class ConfigurationPropertiesBindingPostProcessorRegistrar implements ImportBeanDefinitionRegistrar { - - @Override - public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { - // Spring Cloud Function may call this with a null importingClassMetadata - if (importingClassMetadata == null) { - EnableConfigurationPropertiesRegistrar.registerInfrastructureBeans(registry); - return; - } - new EnableConfigurationPropertiesRegistrar().registerBeanDefinitions(importingClassMetadata, registry); - } - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java index d5edb7f650..7dadda9bd9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -51,7 +51,6 @@ class EnableConfigurationPropertiesRegistrar implements ImportBeanDefinitionRegi ConfigurationPropertiesBindingPostProcessor.register(registry); BoundConfigurationProperties.register(registry); ConfigurationPropertiesBeanDefinitionValidator.register(registry); - ConfigurationBeanFactoryMetadata.register(registry); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java index fb8d1d8480..2cc1286659 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import org.springframework.beans.BeanUtils; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; @@ -113,19 +112,6 @@ public final class BindResult { return (this.value != null) ? this.value : other.get(); } - /** - * Return the object that was bound, or a new instance of the specified class if no - * value has been bound. - * @param type the type to create if no value was bound - * @return the value, if bound, otherwise a new instance of {@code type} - * @deprecated since 2.2.0 in favor of {@link Binder#bindOrCreate} - */ - @Deprecated - public T orElseCreate(Class type) { - Assert.notNull(type, "Type must not be null"); - return (this.value != null) ? this.value : BeanUtils.instantiateClass(type); - } - /** * Return the object that was bound, or throw an exception to be created by the * provided supplier if no value has been bound. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java index 569d9204fa..03797d4948 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -16,17 +16,11 @@ package org.springframework.boot.web.reactive.context; -import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.annotation.AnnotatedBeanDefinitionReader; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.ClassPathBeanDefinitionScanner; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; -import org.springframework.context.annotation.ScopeMetadataResolver; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.io.Resource; -import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; /** @@ -99,230 +93,4 @@ public class AnnotationConfigReactiveWebApplicationContext extends AnnotationCon return new FilteredReactiveWebContextResource(path); } - /** - * Return the custom {@link BeanNameGenerator} for use with - * {@link AnnotatedBeanDefinitionReader} and/or - * {@link ClassPathBeanDefinitionScanner}, if any. - * @return the bean name generator - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext} - */ - @Deprecated - protected final BeanNameGenerator getBeanNameGenerator() { - throw new UnsupportedOperationException(); - } - - /** - * Return the custom {@link ScopeMetadataResolver} for use with - * {@link AnnotatedBeanDefinitionReader} and/or - * {@link ClassPathBeanDefinitionScanner}, if any. - * @return the scope metadata resolver - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext} - */ - @Deprecated - protected ScopeMetadataResolver getScopeMetadataResolver() { - throw new UnsupportedOperationException(); - } - - /** - * Register a {@link org.springframework.beans.factory.config.BeanDefinition} for any - * classes specified by {@link #register(Class...)} and scan any packages specified by - * {@link #scan(String...)}. - *

- * For any values specified by {@link #setConfigLocation(String)} or - * {@link #setConfigLocations(String[])}, attempt first to load each location as a - * class, registering a {@code BeanDefinition} if class loading is successful, and if - * class loading fails (i.e. a {@code ClassNotFoundException} is raised), assume the - * value is a package and attempt to scan it for annotated classes. - *

- * Enables the default set of annotation configuration post processors, such that - * {@code @Autowired}, {@code @Required}, and associated annotations can be used. - *

- * Configuration class bean definitions are registered with generated bean definition - * names unless the {@code value} attribute is provided to the stereotype annotation. - * @param beanFactory the bean factory to load bean definitions into - * @see #register(Class...) - * @see #scan(String...) - * @see #setConfigLocation(String) - * @see #setConfigLocations(String[]) - * @see AnnotatedBeanDefinitionReader - * @see ClassPathBeanDefinitionScanner - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext} - */ - @Deprecated - protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) { - throw new UnsupportedOperationException(); - } - - /** - * Build an {@link AnnotatedBeanDefinitionReader} for the given bean factory. - *

- * This should be pre-configured with the {@code Environment} (if desired) but not - * with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet. - * @param beanFactory the bean factory to load bean definitions into - * @return the annotated bean definition reader - * @see #getEnvironment() - * @see #getBeanNameGenerator() - * @see #getScopeMetadataResolver() - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext} - */ - @Deprecated - protected AnnotatedBeanDefinitionReader getAnnotatedBeanDefinitionReader(DefaultListableBeanFactory beanFactory) { - throw new UnsupportedOperationException(); - } - - /** - * Build a {@link ClassPathBeanDefinitionScanner} for the given bean factory. - *

- * This should be pre-configured with the {@code Environment} (if desired) but not - * with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet. - * @param beanFactory the bean factory to load bean definitions into - * @return the class path bean definition scanner - * @see #getEnvironment() - * @see #getBeanNameGenerator() - * @see #getScopeMetadataResolver() - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext} - */ - @Deprecated - protected ClassPathBeanDefinitionScanner getClassPathBeanDefinitionScanner(DefaultListableBeanFactory beanFactory) { - throw new UnsupportedOperationException(); - } - - /** - * Set the config locations for this application context in init-param style, i.e. - * with distinct locations separated by commas, semicolons or whitespace. - *

- * If not set, the implementation may use a default as appropriate. - * @param location the config location - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. Use - * {@link ImportResource @ImportResource} instead. - */ - @Deprecated - public void setConfigLocation(String location) { - throw new UnsupportedOperationException(); - } - - /** - * Set the config locations for this application context. - *

- * If not set, the implementation may use a default as appropriate. - * @param locations the config locations - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. Use - * {@link ImportResource @ImportResource} instead. - */ - @Deprecated - public void setConfigLocations(@Nullable String... locations) { - throw new UnsupportedOperationException(); - } - - /** - * Return an array of resource locations, referring to the XML bean definition files - * that this context should be built with. Can also include location patterns, which - * will get resolved via a ResourcePatternResolver. - *

- * The default implementation returns {@code null}. Subclasses can override this to - * provide a set of resource locations to load bean definitions from. - * @return an array of resource locations, or {@code null} if none - * @see #getResources - * @see #getResourcePatternResolver - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected String[] getConfigLocations() { - throw new UnsupportedOperationException(); - } - - /** - * Return the default config locations to use, for the case where no explicit config - * locations have been specified. - *

- * The default implementation returns {@code null}, requiring explicit config - * locations. - * @return an array of default config locations, if any - * @see #setConfigLocations - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected String[] getDefaultConfigLocations() { - throw new UnsupportedOperationException(); - } - - /** - * Resolve the given path, replacing placeholders with corresponding environment - * property values if necessary. Applied to config locations. - * @param path the original file path - * @return the resolved file path - * @see org.springframework.core.env.Environment#resolveRequiredPlaceholders(String) - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected String resolvePath(String path) { - throw new UnsupportedOperationException(); - } - - /** - * Determine whether this context currently holds a bean factory, i.e. has been - * refreshed at least once and not been closed yet. - * @return {@code true} if the context holds a bean factory - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected final boolean hasBeanFactory() { - return true; - } - - /** - * Create an internal bean factory for this context. Called for each - * {@link #refresh()} attempt. - *

- * The default implementation creates a - * {@link org.springframework.beans.factory.support.DefaultListableBeanFactory} with - * the {@linkplain #getInternalParentBeanFactory() internal bean factory} of this - * context's parent as parent bean factory. Can be overridden in subclasses, for - * example to customize DefaultListableBeanFactory's settings. - * @return the bean factory for this context - * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowBeanDefinitionOverriding - * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowEagerClassLoading - * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowCircularReferences - * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected DefaultListableBeanFactory createBeanFactory() { - throw new UnsupportedOperationException(); - } - - /** - * Customize the internal bean factory used by this context. Called for each - * {@link #refresh()} attempt. - *

- * The default implementation applies this context's - * {@linkplain #setAllowBeanDefinitionOverriding "allowBeanDefinitionOverriding"} and - * {@linkplain #setAllowCircularReferences "allowCircularReferences"} settings, if - * specified. Can be overridden in subclasses to customize any of - * {@link DefaultListableBeanFactory}'s settings. - * @param beanFactory the newly created bean factory for this context - * @see DefaultListableBeanFactory#setAllowBeanDefinitionOverriding - * @see DefaultListableBeanFactory#setAllowCircularReferences - * @see DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping - * @see DefaultListableBeanFactory#setAllowEagerClassLoading - * @deprecated since 2.2.0 since this class no longer extends - * {@code AbstractRefreshableConfigApplicationContext}. - */ - @Deprecated - protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) { - throw new UnsupportedOperationException(); - } - } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java index 9e6611e10a..172a8d9ab1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -111,19 +111,6 @@ public class ReactiveWebServerApplicationContext extends GenericReactiveWebAppli return getBeanFactory().getBean(factoryBeanName, ReactiveWebServerFactory.class); } - /** - * Return the {@link ReactiveWebServerFactory} that should be used to create the - * reactive web server. By default this method searches for a suitable bean in the - * context itself. - * @return a {@link ReactiveWebServerFactory} (never {@code null}) - * @deprecated since 2.2.0 in favor of {@link #getWebServerFactoryBeanName()} and - * {@link #getWebServerFactory(String)} - */ - @Deprecated - protected ReactiveWebServerFactory getWebServerFactory() { - return getWebServerFactory(getWebServerFactoryBeanName()); - } - @Override protected void finishRefresh() { super.finishRefresh(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java index 266b06ab41..54da50ac43 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -99,7 +99,6 @@ import static org.mockito.Mockito.verify; /** * Tests for {@link ConfigurationProperties @ConfigurationProperties}-annotated beans. * Covers {@link EnableConfigurationProperties @EnableConfigurationProperties}, - * {@link ConfigurationPropertiesBindingPostProcessorRegistrar}, * {@link ConfigurationPropertiesBindingPostProcessor} and * {@link ConfigurationPropertiesBinder}. * diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java index 4a128f6a87..21c8b6298b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -150,29 +150,6 @@ class BindResultTests { assertThat(result.orElseGet(this.supplier)).isEqualTo("bar"); } - @Test - @Deprecated - @SuppressWarnings("deprecation") - void orElseCreateWhenTypeIsNullShouldThrowException() { - BindResult result = BindResult.of("foo"); - assertThatIllegalArgumentException().isThrownBy(() -> result.orElseCreate(null)) - .withMessageContaining("Type must not be null"); - } - - @Test - @Deprecated - void orElseCreateWhenHasValueShouldReturnValue() { - BindResult result = BindResult.of(new ExampleBean("foo")); - assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("foo"); - } - - @Test - @Deprecated - void orElseCreateWhenHasValueNoShouldReturnCreatedValue() { - BindResult result = BindResult.of(null); - assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("new"); - } - @Test void orElseThrowWhenHasValueShouldReturnValue() throws Exception { BindResult result = BindResult.of("foo");