diff --git a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java index f4389ca844..776afeb831 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java @@ -157,7 +157,7 @@ class JavaConventions { args.add("-parameters"); } if (JavaVersion.current() == JavaVersion.VERSION_1_8) { - args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked")); + args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation")); } }); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeHealthIndicatorConfiguration.java index 4ed3da3bee..8bf2f7d7fb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeHealthIndicatorConfiguration.java @@ -19,16 +19,12 @@ package org.springframework.boot.actuate.autoconfigure.health; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.health.CompositeHealthIndicator; -import org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry; -import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.HealthIndicator; -import org.springframework.boot.actuate.health.HealthIndicatorRegistry; import org.springframework.core.ResolvableType; /** * Base class for configurations that can combine source beans using a - * {@link CompositeHealthIndicator}. + * {@link org.springframework.boot.actuate.health.CompositeHealthIndicator}. * * @param the health indicator type * @param the bean source type @@ -40,15 +36,15 @@ import org.springframework.core.ResolvableType; public abstract class CompositeHealthIndicatorConfiguration { @Autowired - private HealthAggregator healthAggregator; + private org.springframework.boot.actuate.health.HealthAggregator healthAggregator; protected HealthIndicator createHealthIndicator(Map beans) { if (beans.size() == 1) { return createHealthIndicator(beans.values().iterator().next()); } - HealthIndicatorRegistry registry = new DefaultHealthIndicatorRegistry(); + org.springframework.boot.actuate.health.HealthIndicatorRegistry registry = new org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry(); beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source))); - return new CompositeHealthIndicator(this.healthAggregator, registry); + return new org.springframework.boot.actuate.health.CompositeHealthIndicator(this.healthAggregator, registry); } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeReactiveHealthIndicatorConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeReactiveHealthIndicatorConfiguration.java index 06f788bbc7..ddee36d180 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeReactiveHealthIndicatorConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeReactiveHealthIndicatorConfiguration.java @@ -19,11 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.health; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.health.CompositeReactiveHealthIndicator; -import org.springframework.boot.actuate.health.DefaultReactiveHealthIndicatorRegistry; -import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; -import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry; import org.springframework.core.ResolvableType; /** @@ -40,15 +36,16 @@ import org.springframework.core.ResolvableType; public abstract class CompositeReactiveHealthIndicatorConfiguration { @Autowired - private HealthAggregator healthAggregator; + private org.springframework.boot.actuate.health.HealthAggregator healthAggregator; protected ReactiveHealthIndicator createHealthIndicator(Map beans) { if (beans.size() == 1) { return createHealthIndicator(beans.values().iterator().next()); } - ReactiveHealthIndicatorRegistry registry = new DefaultReactiveHealthIndicatorRegistry(); + org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry registry = new org.springframework.boot.actuate.health.DefaultReactiveHealthIndicatorRegistry(); beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source))); - return new CompositeReactiveHealthIndicator(this.healthAggregator, registry); + return new org.springframework.boot.actuate.health.CompositeReactiveHealthIndicator(this.healthAggregator, + registry); } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthAggregatorStatusAggregatorAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthAggregatorStatusAggregatorAdapter.java index 0db0ab334b..c3867299ce 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthAggregatorStatusAggregatorAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthAggregatorStatusAggregatorAdapter.java @@ -21,12 +21,12 @@ import java.util.Map; import java.util.Set; import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.StatusAggregator; /** - * Adapter class to convert a legacy {@link HealthAggregator} to a + * Adapter class to convert a legacy + * {@link org.springframework.boot.actuate.health.HealthAggregator} to a * {@link StatusAggregator}. * * @author Phillip Webb @@ -34,9 +34,9 @@ import org.springframework.boot.actuate.health.StatusAggregator; @SuppressWarnings("deprecation") class HealthAggregatorStatusAggregatorAdapter implements StatusAggregator { - private HealthAggregator healthAggregator; + private org.springframework.boot.actuate.health.HealthAggregator healthAggregator; - HealthAggregatorStatusAggregatorAdapter(HealthAggregator healthAggregator) { + HealthAggregatorStatusAggregatorAdapter(org.springframework.boot.actuate.health.HealthAggregator healthAggregator) { this.healthAggregator = healthAggregator; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapter.java index 0d79152461..dafea4c44d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthContributorRegistryHealthIndicatorRegistryAdapter.java @@ -22,18 +22,18 @@ import java.util.Map; import org.springframework.boot.actuate.health.HealthContributor; import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthIndicator; -import org.springframework.boot.actuate.health.HealthIndicatorRegistry; import org.springframework.boot.actuate.health.NamedContributor; import org.springframework.util.Assert; /** * Adapter class to convert a {@link HealthContributorRegistry} to a legacy - * {@link HealthIndicatorRegistry}. + * {@link org.springframework.boot.actuate.health.HealthIndicatorRegistry}. * * @author Phillip Webb */ @SuppressWarnings("deprecation") -class HealthContributorRegistryHealthIndicatorRegistryAdapter implements HealthIndicatorRegistry { +class HealthContributorRegistryHealthIndicatorRegistryAdapter + implements org.springframework.boot.actuate.health.HealthIndicatorRegistry { private final HealthContributorRegistry contributorRegistry; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/LegacyHealthEndpointCompatibilityConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/LegacyHealthEndpointCompatibilityConfiguration.java index b83cbfbfc9..e06910737f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/LegacyHealthEndpointCompatibilityConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/LegacyHealthEndpointCompatibilityConfiguration.java @@ -18,12 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.health; import reactor.core.publisher.Mono; -import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.HealthContributorRegistry; -import org.springframework.boot.actuate.health.HealthIndicatorRegistry; -import org.springframework.boot.actuate.health.OrderedHealthAggregator; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; -import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -40,13 +36,14 @@ import org.springframework.util.CollectionUtils; */ @Configuration(proxyBeanMethods = false) @SuppressWarnings("deprecation") -@EnableConfigurationProperties(HealthIndicatorProperties.class) +@EnableConfigurationProperties(org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties.class) class LegacyHealthEndpointCompatibilityConfiguration { @Bean @ConditionalOnMissingBean - HealthAggregator healthAggregator(HealthIndicatorProperties healthIndicatorProperties) { - OrderedHealthAggregator aggregator = new OrderedHealthAggregator(); + org.springframework.boot.actuate.health.HealthAggregator healthAggregator( + HealthIndicatorProperties healthIndicatorProperties) { + org.springframework.boot.actuate.health.OrderedHealthAggregator aggregator = new org.springframework.boot.actuate.health.OrderedHealthAggregator(); if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) { aggregator.setStatusOrder(healthIndicatorProperties.getOrder()); } @@ -54,7 +51,7 @@ class LegacyHealthEndpointCompatibilityConfiguration { } @Bean - @ConditionalOnMissingBean(HealthIndicatorRegistry.class) + @ConditionalOnMissingBean(org.springframework.boot.actuate.health.HealthIndicatorRegistry.class) HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry( HealthContributorRegistry healthContributorRegistry) { return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry); @@ -65,7 +62,7 @@ class LegacyHealthEndpointCompatibilityConfiguration { static class LegacyReactiveHealthEndpointCompatibilityConfiguration { @Bean - @ConditionalOnMissingBean(ReactiveHealthIndicatorRegistry.class) + @ConditionalOnMissingBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class) ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry( ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) { return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter.java index 7fe30baeb8..12f1713d1b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter.java @@ -23,18 +23,17 @@ import org.springframework.boot.actuate.health.NamedContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; -import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry; import org.springframework.util.Assert; /** * Adapter class to convert a {@link ReactiveHealthContributorRegistry} to a legacy - * {@link ReactiveHealthIndicatorRegistry}. + * {@link org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry}. * * @author Phillip Webb */ @SuppressWarnings("deprecation") class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter - implements ReactiveHealthIndicatorRegistry { + implements org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry { private final ReactiveHealthContributorRegistry contributorRegistry; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaPropertiesConfigAdapter.java index fa026187ee..7cdc1dbaa8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaPropertiesConfigAdapter.java @@ -57,6 +57,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter candidates) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java index 17eeb0d948..953595f499 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointAutoConfigurationTests.java @@ -28,11 +28,9 @@ import reactor.core.publisher.Mono; import org.springframework.boot.actuate.endpoint.SecurityContext; import org.springframework.boot.actuate.endpoint.http.ApiVersion; import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; -import org.springframework.boot.actuate.health.AbstractHealthAggregator; import org.springframework.boot.actuate.health.DefaultHealthContributorRegistry; import org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.HealthComponent; import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthEndpoint; @@ -45,7 +43,6 @@ import org.springframework.boot.actuate.health.NamedContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; -import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -283,7 +280,8 @@ class HealthEndpointAutoConfigurationTests { @Test // gh-18354 void runCreatesLegacyHealthAggregator() { this.contextRunner.run((context) -> { - HealthAggregator aggregator = context.getBean(HealthAggregator.class); + org.springframework.boot.actuate.health.HealthAggregator aggregator = context + .getBean(org.springframework.boot.actuate.health.HealthAggregator.class); Map healths = new LinkedHashMap<>(); healths.put("one", Health.up().build()); healths.put("two", Health.down().build()); @@ -294,13 +292,15 @@ class HealthEndpointAutoConfigurationTests { @Test void runWhenReactorAvailableCreatesReactiveHealthIndicatorRegistryBean() { - this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ReactiveHealthIndicatorRegistry.class)); + this.contextRunner.run((context) -> assertThat(context) + .hasSingleBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class)); } @Test // gh-18570 void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() { this.contextRunner.withClassLoader(new FilteredClassLoader(Mono.class.getPackage().getName())) - .run((context) -> assertThat(context).doesNotHaveBean(ReactiveHealthIndicatorRegistry.class)); + .run((context) -> assertThat(context).doesNotHaveBean( + org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class)); } @Test @@ -337,8 +337,8 @@ class HealthEndpointAutoConfigurationTests { static class HealthAggregatorConfiguration { @Bean - HealthAggregator healthAggregator() { - return new AbstractHealthAggregator() { + org.springframework.boot.actuate.health.HealthAggregator healthAggregator() { + return new org.springframework.boot.actuate.health.AbstractHealthAggregator() { @Override protected Status aggregateStatus(List candidates) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java index a1eb2bbf0d..6d4573456b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorRegistryInjectionIntegrationTests.java @@ -23,9 +23,6 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; -import org.springframework.boot.actuate.health.CompositeHealthIndicator; -import org.springframework.boot.actuate.health.HealthAggregator; -import org.springframework.boot.actuate.health.HealthIndicatorRegistry; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -35,7 +32,8 @@ import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; /** - * Integration test to ensure that the legacy {@link HealthIndicatorRegistry} can still be + * Integration test to ensure that the legacy + * {@link org.springframework.boot.actuate.health.HealthIndicatorRegistry} can still be * injected. * * @author Phillip Webb @@ -57,16 +55,17 @@ public class HealthIndicatorRegistryInjectionIntegrationTests { CompositeMeterRegistryAutoConfiguration.class, MetricsAutoConfiguration.class }) static class Config { - Config(HealthAggregator healthAggregator, HealthIndicatorRegistry healthIndicatorRegistry, + Config(org.springframework.boot.actuate.health.HealthAggregator healthAggregator, + org.springframework.boot.actuate.health.HealthIndicatorRegistry healthIndicatorRegistry, MeterRegistry registry) { - CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(healthAggregator, - healthIndicatorRegistry); + org.springframework.boot.actuate.health.CompositeHealthIndicator healthIndicator = new org.springframework.boot.actuate.health.CompositeHealthIndicator( + healthAggregator, healthIndicatorRegistry); Gauge.builder("health", healthIndicator, this::getGaugeValue) .description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN") .strongReference(true).register(registry); } - private double getGaugeValue(CompositeHealthIndicator health) { + private double getGaugeValue(org.springframework.boot.actuate.health.CompositeHealthIndicator health) { Status status = health.health().getStatus(); switch (status.getCode()) { case "UP": diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java index 258505d02f..b58bcba7cb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.web.ErrorProperties; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.mock.web.MockHttpServletRequest; @@ -111,7 +112,7 @@ class ManagementErrorEndpointTests { ErrorAttributes attributes = new ErrorAttributes() { @Override - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { return Collections.singletonMap("message", "An error occurred"); } @@ -154,7 +155,7 @@ class ManagementErrorEndpointTests { ErrorAttributes attributes = new DefaultErrorAttributes() { @Override - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { return Collections.singletonMap("error", "custom error"); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java index 35597ea1ff..e3d4f45aae 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java @@ -158,6 +158,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin return new RequestMatchResult(patterns.iterator().next(), lookupPath, getPathMatcher()); } + @SuppressWarnings("deprecation") private static RequestMappingInfo.BuilderConfiguration getBuilderConfig() { RequestMappingInfo.BuilderConfiguration config = new RequestMappingInfo.BuilderConfiguration(); config.setUrlPathHelper(null); @@ -215,6 +216,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin HttpServletRequest.class, HttpServletResponse.class)); } + @SuppressWarnings("deprecation") private PatternsRequestCondition patternsRequestConditionForPattern(String path) { String[] patterns = new String[] { this.endpointMapping.createSubPath(path) }; return new PatternsRequestCondition(patterns, builderConfig.getUrlPathHelper(), builderConfig.getPathMatcher(), diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java index f06cf3406b..9b4bd0ddf2 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.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. @@ -58,6 +58,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi * @param endpoints the web endpoints * @param corsConfiguration the CORS configuration for the endpoints or {@code null} */ + @SuppressWarnings("deprecation") public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping, Collection endpoints, CorsConfiguration corsConfiguration) { Assert.notNull(endpointMapping, "EndpointMapping must not be null"); @@ -102,6 +103,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern); } + @SuppressWarnings("deprecation") private RequestMappingInfo withNewPatterns(RequestMappingInfo mapping, String[] patterns) { PatternsRequestCondition patternsCondition = new PatternsRequestCondition(patterns, null, null, useSuffixPatternMatch(), useTrailingSlashMatch(), null); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/SkipPathExtensionContentNegotiation.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/SkipPathExtensionContentNegotiation.java index 43fd5aaafd..9aa7889180 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/SkipPathExtensionContentNegotiation.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/SkipPathExtensionContentNegotiation.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. @@ -19,18 +19,20 @@ package org.springframework.boot.actuate.endpoint.web.servlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.web.accept.PathExtensionContentNegotiationStrategy; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; /** * {@link HandlerInterceptorAdapter} to ensure that - * {@link PathExtensionContentNegotiationStrategy} is skipped for web endpoints. + * {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy} is + * skipped for web endpoints. * * @author Phillip Webb */ final class SkipPathExtensionContentNegotiation extends HandlerInterceptorAdapter { - private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP"; + @SuppressWarnings("deprecation") + private static final String SKIP_ATTRIBUTE = org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class + .getName() + ".SKIP"; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfiguration.java index 87e8a50000..d2946d7ef6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfiguration.java @@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories; @@ -38,7 +38,7 @@ import org.springframework.data.elasticsearch.repository.config.EnableReactiveEl * @since 1.1.0 */ @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ ElasticsearchTemplate.class }) +@ConditionalOnClass({ ElasticsearchRestTemplate.class }) @AutoConfigureAfter({ ElasticsearchRestClientAutoConfiguration.class, ReactiveElasticsearchRestClientAutoConfiguration.class }) @Import({ ElasticsearchDataConfiguration.BaseConfiguration.class, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java index e9f531efbb..6079d527ec 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java @@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.integration; import javax.management.MBeanServer; import javax.sql.DataSource; -import io.rsocket.RSocketFactory; import io.rsocket.transport.netty.server.TcpServerTransport; import org.springframework.beans.factory.BeanFactory; @@ -156,8 +155,9 @@ public class IntegrationAutoConfiguration { /** * Integration RSocket configuration. */ + @SuppressWarnings("deprecation") @Configuration(proxyBeanMethods = false) - @ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, RSocketFactory.class }) + @ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, io.rsocket.RSocketFactory.class }) @Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class) protected static class IntegrationRSocketConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java index 3df21be4ee..6d47dcfd58 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedConfigurationFactory.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. @@ -18,12 +18,12 @@ package org.springframework.boot.autoconfigure.jms.artemis; import java.io.File; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.server.JournalType; @@ -77,7 +77,7 @@ class ArtemisEmbeddedConfigurationFactory { private CoreAddressConfiguration createAddressConfiguration(String name) { return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration( - new CoreQueueConfiguration().setName(name).setRoutingType(RoutingType.ANYCAST).setAddress(name)); + new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).setAddress(name)); } private String getDataDir() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java index 300b263905..336b87c695 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.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. @@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.jms.artemis; import java.util.List; import java.util.stream.Collectors; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration; @@ -71,7 +71,7 @@ class ArtemisEmbeddedServerConfiguration { String queueName = queueConfiguration.getName(); configuration.addAddressConfiguration( new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration(new CoreQueueConfiguration().setAddress(queueName).setName(queueName) + .addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName) .setFilterString(queueConfiguration.getSelector()) .setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST))); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java index a00cf4efa2..b089170b48 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketMessagingAutoConfiguration.java @@ -16,7 +16,6 @@ package org.springframework.boot.autoconfigure.rsocket; -import io.rsocket.RSocketFactory; import io.rsocket.transport.netty.server.TcpServerTransport; import org.springframework.beans.factory.ObjectProvider; @@ -37,8 +36,9 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa * @author Brian Clozel * @since 2.2.0 */ +@SuppressWarnings("deprecation") @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class }) +@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, TcpServerTransport.class }) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class) public class RSocketMessagingAutoConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfiguration.java index 64366ebea4..d244ae2c8e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketRequesterAutoConfiguration.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,7 +16,6 @@ package org.springframework.boot.autoconfigure.rsocket; -import io.rsocket.RSocketFactory; import io.rsocket.transport.netty.server.TcpServerTransport; import reactor.netty.http.server.HttpServer; @@ -40,8 +39,10 @@ import org.springframework.messaging.rsocket.RSocketStrategies; * @author Brian Clozel * @since 2.2.0 */ +@SuppressWarnings("deprecation") @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, HttpServer.class, TcpServerTransport.class }) +@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, HttpServer.class, + TcpServerTransport.class }) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class) public class RSocketRequesterAutoConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java index 866d7ed147..32e84ca828 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfiguration.java @@ -38,7 +38,6 @@ import org.springframework.boot.rsocket.context.RSocketServerBootstrap; import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory; import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerFactory; -import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; @@ -72,7 +71,8 @@ public class RSocketServerAutoConfiguration { @ConditionalOnMissingBean @SuppressWarnings("deprecation") RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties, - RSocketMessageHandler messageHandler, ObjectProvider processors, + RSocketMessageHandler messageHandler, + ObjectProvider processors, ObjectProvider customizers) { return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(), messageHandler.responder(), processors.orderedStream(), customizers.orderedStream()); @@ -94,7 +94,7 @@ public class RSocketServerAutoConfiguration { @ConditionalOnMissingBean @SuppressWarnings("deprecation") RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory, - ObjectProvider processors, + ObjectProvider processors, ObjectProvider customizers) { NettyRSocketServerFactory factory = new NettyRSocketServerFactory(); factory.setResourceFactory(resourceFactory); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java index b458d8739d..05d2902ee9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketStrategiesAutoConfiguration.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. @@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.cbor.CBORFactory; import io.netty.buffer.PooledByteBufAllocator; -import io.rsocket.RSocketFactory; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfigureAfter; @@ -48,8 +47,9 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher; * @author Brian Clozel * @since 2.2.0 */ +@SuppressWarnings("deprecation") @Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class }) +@ConditionalOnClass({ io.rsocket.RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class }) @AutoConfigureAfter(JacksonAutoConfiguration.class) public class RSocketStrategiesAutoConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProvider.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProvider.java index 5cab049840..f1ebd0a55f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProvider.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProvider.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import io.rsocket.RSocketFactory; import io.rsocket.SocketAcceptor; import io.rsocket.core.RSocketServer; import io.rsocket.transport.ServerTransport; @@ -28,7 +27,6 @@ import io.rsocket.transport.netty.server.WebsocketRouteTransport; import reactor.netty.http.server.HttpServerRoutes; import org.springframework.boot.rsocket.server.RSocketServerCustomizer; -import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor; import org.springframework.boot.web.embedded.netty.NettyRouteProvider; /** @@ -43,12 +41,13 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider { private final SocketAcceptor socketAcceptor; - private final List processors; + private final List processors; private final List customizers; RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor, - Stream processors, Stream customizers) { + Stream processors, + Stream customizers) { this.mappingPath = mappingPath; this.socketAcceptor = socketAcceptor; this.processors = processors.collect(Collectors.toList()); @@ -58,7 +57,8 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider { @Override public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) { RSocketServer server = RSocketServer.create(this.socketAcceptor); - RSocketFactory.ServerRSocketFactory factory = new RSocketFactory.ServerRSocketFactory(server); + io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory( + server); this.processors.forEach((processor) -> processor.process(factory)); this.customizers.forEach((customizer) -> customizer.customize(server)); ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java index 8ddf9e5cae..45aa9a4348 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java @@ -34,9 +34,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.jdbc.XADataSourceWrapper; import org.springframework.boot.jms.XAConnectionFactoryWrapper; -import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor; -import org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper; -import org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper; import org.springframework.boot.system.ApplicationHome; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -92,14 +89,14 @@ class BitronixJtaConfiguration { @Bean @ConditionalOnMissingBean(XADataSourceWrapper.class) - BitronixXADataSourceWrapper xaDataSourceWrapper() { - return new BitronixXADataSourceWrapper(); + org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper xaDataSourceWrapper() { + return new org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper(); } @Bean @ConditionalOnMissingBean - static BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() { - return new BitronixDependentBeanFactoryPostProcessor(); + static org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() { + return new org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor(); } @Bean @@ -116,8 +113,8 @@ class BitronixJtaConfiguration { @Bean @ConditionalOnMissingBean(XAConnectionFactoryWrapper.class) - BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() { - return new BitronixXAConnectionFactoryWrapper(); + org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() { + return new org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper(); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java index 2167937eee..92dcd20013 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java @@ -82,7 +82,6 @@ import org.springframework.validation.Validator; import org.springframework.web.HttpMediaTypeNotAcceptableException; import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationStrategy; -import org.springframework.web.accept.PathExtensionContentNegotiationStrategy; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.RequestAttributes; @@ -499,13 +498,14 @@ public class WebMvcAutoConfiguration { @Bean @Override + @SuppressWarnings("deprecation") public ContentNegotiationManager mvcContentNegotiationManager() { ContentNegotiationManager manager = super.mvcContentNegotiationManager(); List strategies = manager.getStrategies(); ListIterator iterator = strategies.listIterator(); while (iterator.hasNext()) { ContentNegotiationStrategy strategy = iterator.next(); - if (strategy instanceof PathExtensionContentNegotiationStrategy) { + if (strategy instanceof org.springframework.web.accept.PathExtensionContentNegotiationStrategy) { iterator.set(new OptionalPathExtensionContentNegotiationStrategy(strategy)); } } @@ -577,12 +577,15 @@ public class WebMvcAutoConfiguration { } /** - * Decorator to make {@link PathExtensionContentNegotiationStrategy} optional - * depending on a request attribute. + * Decorator to make + * {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy} + * optional depending on a request attribute. */ static class OptionalPathExtensionContentNegotiationStrategy implements ContentNegotiationStrategy { - private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP"; + @SuppressWarnings("deprecation") + private static final String SKIP_ATTRIBUTE = org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class + .getName() + ".SKIP"; private final ContentNegotiationStrategy delegate; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index 42bc6fa97c..a431d079d7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -82,6 +82,7 @@ public class BasicErrorController extends AbstractErrorController { } @Override + @Deprecated public String getErrorPath() { return null; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/JettyWebSocketServletWebServerCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/JettyWebSocketServletWebServerCustomizer.java index 1d514dc255..6b057b0714 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/JettyWebSocketServletWebServerCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/JettyWebSocketServletWebServerCustomizer.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. @@ -43,7 +43,7 @@ public class JettyWebSocketServletWebServerCustomizer @Override public void configure(WebAppContext context) throws Exception { - ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(context); + ServerContainer serverContainer = WebSocketServerContainerInitializer.initialize(context); ShutdownThread.deregister(serverContainer); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProviderTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProviderTests.java index 7d85b90c36..3c1947c6f3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProviderTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketWebSocketNettyRouteProviderTests.java @@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration; -import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext; @@ -109,7 +108,8 @@ class RSocketWebSocketNettyRouteProviderTests { } @Bean - ServerRSocketFactoryProcessor myRSocketFactoryProcessor() { + @SuppressWarnings("deprecation") + org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor myRSocketFactoryProcessor() { return (server) -> { processorCallCount++; return server; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java index 1170e0b71f..502d620d9d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfigurationTests.java @@ -47,9 +47,6 @@ import org.springframework.boot.jms.XAConnectionFactoryWrapper; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor; import org.springframework.boot.jta.atomikos.AtomikosProperties; -import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor; -import org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean; -import org.springframework.boot.jta.bitronix.PoolingDataSourceBean; import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -71,7 +68,7 @@ import static org.mockito.Mockito.mock; * @author Kazuki Shimizu * @author Nishant Raut */ -@SuppressWarnings("deprecation") +// @SuppressWarnings("deprecation") class JtaAutoConfigurationTests { private AnnotationConfigApplicationContext context; @@ -123,7 +120,7 @@ class JtaAutoConfigurationTests { this.context.getBean(TransactionManager.class); this.context.getBean(XADataSourceWrapper.class); this.context.getBean(XAConnectionFactoryWrapper.class); - this.context.getBean(BitronixDependentBeanFactoryPostProcessor.class); + this.context.getBean(org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor.class); this.context.getBean(JtaTransactionManager.class); } @@ -178,7 +175,8 @@ class JtaAutoConfigurationTests { "spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); - PoolingConnectionFactoryBean connectionFactory = this.context.getBean(PoolingConnectionFactoryBean.class); + org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean connectionFactory = this.context + .getBean(org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean.class); assertThat(connectionFactory.getMinPoolSize()).isEqualTo(5); assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10); } @@ -205,7 +203,8 @@ class JtaAutoConfigurationTests { .applyTo(this.context); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.refresh(); - PoolingDataSourceBean dataSource = this.context.getBean(PoolingDataSourceBean.class); + org.springframework.boot.jta.bitronix.PoolingDataSourceBean dataSource = this.context + .getBean(org.springframework.boot.jta.bitronix.PoolingDataSourceBean.class); assertThat(dataSource.getMinPoolSize()).isEqualTo(5); assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index da2b47e754..b0cf8de797 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -145,13 +145,13 @@ class ServerPropertiesTests { assertThat(accesslog.isRenameOnRotate()).isTrue(); assertThat(accesslog.isIpv6Canonical()).isTrue(); assertThat(accesslog.isRequestAttributesEnabled()).isTrue(); - assertThat(tomcat.getRemoteIpHeader()).isEqualTo("Remote-Ip"); - assertThat(tomcat.getProtocolHeader()).isEqualTo("X-Forwarded-Protocol"); - assertThat(tomcat.getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); + assertThat(tomcat.getRemoteip().getRemoteIpHeader()).isEqualTo("Remote-Ip"); + assertThat(tomcat.getRemoteip().getProtocolHeader()).isEqualTo("X-Forwarded-Protocol"); + assertThat(tomcat.getRemoteip().getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10); assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<'); assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|'); - assertThat(tomcat.getUseRelativeRedirects()).isTrue(); + assertThat(tomcat.isUseRelativeRedirects()).isTrue(); } @Test @@ -444,13 +444,13 @@ class ServerPropertiesTests { @Test void tomcatInternalProxiesMatchesDefault() { - assertThat(this.properties.getTomcat().getInternalProxies()) + assertThat(this.properties.getTomcat().getRemoteip().getInternalProxies()) .isEqualTo(new RemoteIpValve().getInternalProxies()); } @Test void tomcatUseRelativeRedirectsDefaultsToFalse() { - assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse(); + assertThat(this.properties.getTomcat().isUseRelativeRedirects()).isFalse(); } @Test diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java index e22c27bf10..f038700526 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java @@ -233,9 +233,10 @@ class JettyWebServerFactoryCustomizerTests { assertThat(threadPool).isInstanceOf(QueuedThreadPool.class); QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool; Jetty defaultProperties = new Jetty(); - assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getMinThreads()); - assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getMaxThreads()); - assertThat(queuedThreadPool.getIdleTimeout()).isEqualTo(defaultProperties.getThreadIdleTimeout().toMillis()); + assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getThreads().getMin()); + assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getThreads().getMax()); + assertThat(queuedThreadPool.getIdleTimeout()) + .isEqualTo(defaultProperties.getThreads().getIdleTimeout().toMillis()); } private CustomRequestLog getRequestLog(JettyWebServer server) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java index c3338ab1cb..44a2210e4e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/TomcatServletWebServerFactoryCustomizerTests.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. @@ -84,7 +84,7 @@ class TomcatServletWebServerFactoryCustomizerTests { @Test void useRelativeRedirectsCanBeConfigured() { bind("server.tomcat.use-relative-redirects=true"); - assertThat(this.serverProperties.getTomcat().getUseRelativeRedirects()).isTrue(); + assertThat(this.serverProperties.getTomcat().isUseRelativeRedirects()).isTrue(); TomcatWebServer server = customizeAndGetServer(); Context context = (Context) server.getTomcat().getHost().findChildren()[0]; assertThat(context.getUseRelativeRedirects()).isTrue(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java index b53f94b6fb..8c6356a6ab 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java @@ -77,7 +77,6 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ParameterContentNegotiationStrategy; -import org.springframework.web.accept.PathExtensionContentNegotiationStrategy; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @@ -744,6 +743,7 @@ class WebMvcAutoConfigurationTests { } @Test + @SuppressWarnings("deprecation") void defaultPathMatching() { this.contextRunner.run((context) -> { RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class); @@ -754,6 +754,7 @@ class WebMvcAutoConfigurationTests { @Test @Deprecated + @SuppressWarnings("deprecation") void useSuffixPatternMatch() { this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true", "spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> { @@ -807,12 +808,15 @@ class WebMvcAutoConfigurationTests { } @Test + @SuppressWarnings("deprecation") void contentNegotiationStrategySkipsPathExtension() throws Exception { ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class); ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy( delegate); MockHttpServletRequest request = new MockHttpServletRequest(); - request.setAttribute(PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP", Boolean.TRUE); + request.setAttribute( + org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP", + Boolean.TRUE); ServletWebRequest webRequest = new ServletWebRequest(request); List mediaTypes = strategy.resolveMediaTypes(webRequest); assertThat(mediaTypes).containsOnly(MediaType.ALL); @@ -1128,6 +1132,7 @@ class WebMvcAutoConfigurationTests { static class CustomConfigurer implements WebMvcConfigurer { @Override + @SuppressWarnings("deprecation") public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(true); } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java index b0d778e097..1b581a1f7c 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyManagementBomTransformation.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. @@ -35,8 +35,6 @@ import org.apache.maven.model.Repository; import org.apache.maven.model.building.DefaultModelBuilder; import org.apache.maven.model.building.DefaultModelBuilderFactory; import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.building.UrlModelSource; import org.apache.maven.model.resolution.InvalidRepositoryException; import org.apache.maven.model.resolution.ModelResolver; import org.apache.maven.model.resolution.UnresolvableModelException; @@ -167,7 +165,7 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans try { DefaultModelBuildingRequest request = new DefaultModelBuildingRequest(); request.setModelResolver(new GrapeModelResolver()); - request.setModelSource(new UrlModelSource(uri.toURL())); + request.setModelSource(new org.apache.maven.model.building.UrlModelSource(uri.toURL())); request.setSystemProperties(System.getProperties()); Model model = modelBuilder.build(request).getEffectiveModel(); this.resolutionContext.addDependencyManagement(new MavenModelDependencyManagement(model)); @@ -197,25 +195,28 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans private static class GrapeModelResolver implements ModelResolver { @Override - public ModelSource resolveModel(Parent parent) throws UnresolvableModelException { + public org.apache.maven.model.building.ModelSource resolveModel(Parent parent) + throws UnresolvableModelException { return resolveModel(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()); } @Override - public ModelSource resolveModel(Dependency dependency) throws UnresolvableModelException { + public org.apache.maven.model.building.ModelSource resolveModel(Dependency dependency) + throws UnresolvableModelException { return resolveModel(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion()); } @Override - public ModelSource resolveModel(String groupId, String artifactId, String version) - throws UnresolvableModelException { + public org.apache.maven.model.building.ModelSource resolveModel(String groupId, String artifactId, + String version) throws UnresolvableModelException { Map dependency = new HashMap<>(); dependency.put("group", groupId); dependency.put("module", artifactId); dependency.put("version", version); dependency.put("type", "pom"); try { - return new UrlModelSource(Grape.getInstance().resolve(null, dependency)[0].toURL()); + return new org.apache.maven.model.building.UrlModelSource( + Grape.getInstance().resolve(null, dependency)[0].toURL()); } catch (MalformedURLException ex) { throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version); diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java index a3134c78b7..e153201247 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java @@ -16,7 +16,6 @@ package org.springframework.boot.test.mock.mockito; -import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.util.Arrays; import java.util.Collection; @@ -333,8 +332,8 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda } @Override - public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, final Object bean, - String beanName) throws BeansException { + public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) + throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), (field) -> postProcessField(bean, field)); return pvs; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/MavenPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/MavenPluginAction.java index 2cd8f1dedc..94132da2ce 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/MavenPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/MavenPluginAction.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. @@ -19,12 +19,11 @@ package org.springframework.boot.gradle.plugin; import org.gradle.api.Action; import org.gradle.api.Plugin; import org.gradle.api.Project; -import org.gradle.api.artifacts.maven.MavenResolver; -import org.gradle.api.plugins.MavenPlugin; import org.gradle.api.tasks.Upload; /** - * {@link Action} that is executed in response to the {@link MavenPlugin} being applied. + * {@link Action} that is executed in response to the + * {@link org.gradle.api.plugins.MavenPlugin} being applied. * * @author Andy Wilkinson */ @@ -37,8 +36,9 @@ final class MavenPluginAction implements PluginApplicationAction { } @Override + @SuppressWarnings("deprecation") public Class> getPluginClass() { - return MavenPlugin.class; + return org.gradle.api.plugins.MavenPlugin.class; } @Override @@ -50,8 +50,9 @@ final class MavenPluginAction implements PluginApplicationAction { }); } + @SuppressWarnings("deprecation") private void clearConfigurationMappings(Upload upload) { - upload.getRepositories().withType(MavenResolver.class, + upload.getRepositories().withType(org.gradle.api.artifacts.maven.MavenResolver.class, (resolver) -> resolver.getPom().getScopeMappings().getMappings().clear()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index 37971ba11b..90a146a225 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -208,11 +208,13 @@ public class BootJar extends Jar implements BootArchive { } @Override + @Deprecated public boolean isExcludeDevtools() { return this.support.isExcludeDevtools(); } @Override + @Deprecated public void setExcludeDevtools(boolean excludeDevtools) { this.support.setExcludeDevtools(excludeDevtools); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 63d20ee617..ffaed0440e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -165,11 +165,13 @@ public class BootWar extends War implements BootArchive { } @Override + @Deprecated public boolean isExcludeDevtools() { return this.support.isExcludeDevtools(); } @Override + @Deprecated public void setExcludeDevtools(boolean excludeDevtools) { this.support.setExcludeDevtools(excludeDevtools); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java index 368d41cf59..b4fa84a653 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java @@ -81,6 +81,7 @@ class BootWarTests extends AbstractBootArchiveTests { } @Test + @Deprecated void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException { getTask().setMainClassName("com.example.Main"); getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar")); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index f804268827..8a644be460 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -103,6 +103,7 @@ public class ExplodedArchive implements Archive { } @Override + @Deprecated public Iterator iterator() { return new EntryIterator(this.root, this.recursive, null, null); } @@ -321,6 +322,7 @@ public class ExplodedArchive implements Archive { } @Override + @Deprecated public Iterator iterator() { return Collections.emptyIterator(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java index c43c179a20..5fd3e05251 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/JarFileArchive.java @@ -81,6 +81,7 @@ public class JarFileArchive implements Archive { } @Override + @Deprecated public Iterator iterator() { return new EntryIterator(this.jarFile.iterator(), null, null); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java index e1c33db7e8..5901fa6f1c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java @@ -25,6 +25,7 @@ import java.net.URLClassLoader; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.jar.Attributes; @@ -289,7 +290,7 @@ class PropertiesLauncherTests { assertThat(loader.getClass().getName()).isEqualTo(TestLoader.class.getName()); } - private List archives() throws Exception { + private Iterator archives() throws Exception { List archives = new ArrayList<>(); String path = System.getProperty("java.class.path"); for (String url : path.split(File.pathSeparator)) { @@ -298,7 +299,7 @@ class PropertiesLauncherTests { archives.add(archive); } } - return archives; + return archives.iterator(); } private Archive archive(String url) throws IOException { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java index 8cec7bb0dd..1394af6015 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/archive/JarFileArchiveTests.java @@ -148,6 +148,7 @@ class JarFileArchiveTests { File file = new File(this.tempDir, "test.jar"); FileCopyUtils.copy(writeZip64Jar(), file); try (JarFileArchive zip64Archive = new JarFileArchive(file)) { + @SuppressWarnings("deprecation") Iterator entries = zip64Archive.iterator(); for (int i = 0; i < 65537; i++) { assertThat(entries.hasNext()).as(i + "nth file is present").isTrue(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java index dc54ce96e6..971773fef5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java @@ -24,8 +24,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import io.rsocket.RSocketFactory; -import io.rsocket.RSocketFactory.ServerRSocketFactory; import io.rsocket.SocketAcceptor; import io.rsocket.transport.ServerTransport; import io.rsocket.transport.netty.server.CloseableChannel; @@ -39,7 +37,6 @@ import org.springframework.boot.rsocket.server.ConfigurableRSocketServerFactory; import org.springframework.boot.rsocket.server.RSocketServer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerFactory; -import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor; import org.springframework.http.client.reactive.ReactorResourceFactory; import org.springframework.util.Assert; @@ -62,7 +59,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur private Duration lifecycleTimeout; - private List socketFactoryProcessors = new ArrayList<>(); + @SuppressWarnings("deprecation") + private List socketFactoryProcessors = new ArrayList<>(); private List rSocketServerCustomizers = new ArrayList<>(); @@ -90,29 +88,32 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur } /** - * Set {@link ServerRSocketFactoryProcessor}s that should be called to process the - * {@link ServerRSocketFactory} while building the server. Calling this method will - * replace any existing processors. + * Set {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s + * that should be called to process the + * {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server. + * Calling this method will replace any existing processors. * @param socketFactoryProcessors processors to apply before the server starts * @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of * 2.2.7 */ @Deprecated public void setSocketFactoryProcessors( - Collection socketFactoryProcessors) { + Collection socketFactoryProcessors) { Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors); } /** - * Add {@link ServerRSocketFactoryProcessor}s that should be called to process the - * {@link ServerRSocketFactory} while building the server. + * Add {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s + * that should be called to process the + * {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server. * @param socketFactoryProcessors processors to apply before the server starts * @deprecated in favor of * {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7 */ @Deprecated - public void addSocketFactoryProcessors(ServerRSocketFactoryProcessor... socketFactoryProcessors) { + public void addSocketFactoryProcessors( + org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor... socketFactoryProcessors) { Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors)); } @@ -154,7 +155,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur public NettyRSocketServer create(SocketAcceptor socketAcceptor) { ServerTransport transport = createTransport(); io.rsocket.core.RSocketServer server = io.rsocket.core.RSocketServer.create(socketAcceptor); - RSocketFactory.ServerRSocketFactory factory = new ServerRSocketFactory(server); + io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory( + server); this.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server)); this.socketFactoryProcessors.forEach((processor) -> processor.process(factory)); Mono starter = server.bind(transport); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/server/ServerRSocketFactoryProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/server/ServerRSocketFactoryProcessor.java index 0edc20d8e0..4990ebce9e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/server/ServerRSocketFactoryProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/server/ServerRSocketFactoryProcessor.java @@ -16,10 +16,9 @@ package org.springframework.boot.rsocket.server; -import io.rsocket.RSocketFactory.ServerRSocketFactory; - /** - * Processor that allows for custom modification of a {@link ServerRSocketFactory + * Processor that allows for custom modification of a + * {@link io.rsocket.RSocketFactory.ServerRSocketFactory * RSocketFactory.ServerRSocketFactory} before it is used. * * @author Brian Clozel @@ -37,6 +36,6 @@ public interface ServerRSocketFactoryProcessor { * @param factory the factory to process * @return the processed factory instance */ - ServerRSocketFactory process(ServerRSocketFactory factory); + io.rsocket.RSocketFactory.ServerRSocketFactory process(io.rsocket.RSocketFactory.ServerRSocketFactory factory); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java index 1ec436f57d..d073e0f78a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java @@ -25,7 +25,6 @@ import io.netty.buffer.PooledByteBufAllocator; import io.rsocket.ConnectionSetupPayload; import io.rsocket.Payload; import io.rsocket.RSocket; -import io.rsocket.RSocketFactory; import io.rsocket.SocketAcceptor; import io.rsocket.transport.netty.client.WebsocketClientTransport; import io.rsocket.util.DefaultPayload; @@ -37,7 +36,6 @@ import reactor.core.publisher.Mono; import org.springframework.boot.rsocket.server.RSocketServer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer; -import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor; import org.springframework.core.codec.CharSequenceEncoder; import org.springframework.core.codec.StringDecoder; import org.springframework.core.io.buffer.NettyDataBufferFactory; @@ -131,20 +129,20 @@ class NettyRSocketServerFactoryTests { } @Test - @SuppressWarnings("deprecation") + @Deprecated void serverProcessors() { NettyRSocketServerFactory factory = getFactory(); - ServerRSocketFactoryProcessor[] processors = new ServerRSocketFactoryProcessor[2]; + org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[] processors = new org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[2]; for (int i = 0; i < processors.length; i++) { - processors[i] = mock(ServerRSocketFactoryProcessor.class); - given(processors[i].process(any(RSocketFactory.ServerRSocketFactory.class))) + processors[i] = mock(org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor.class); + given(processors[i].process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class))) .will((invocation) -> invocation.getArgument(0)); } factory.setSocketFactoryProcessors(Arrays.asList(processors)); this.server = factory.create(new EchoRequestResponseAcceptor()); InOrder ordered = inOrder((Object[]) processors); - for (ServerRSocketFactoryProcessor processor : processors) { - ordered.verify(processor).process(any(RSocketFactory.ServerRSocketFactory.class)); + for (org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor processor : processors) { + ordered.verify(processor).process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class)); } } @@ -200,6 +198,7 @@ class NettyRSocketServerFactoryTests { static class EchoRequestResponseAcceptor implements SocketAcceptor { @Override + @SuppressWarnings("deprecation") public Mono accept(ConnectionSetupPayload setupPayload, RSocket rSocket) { return Mono.just(new RSocket() { @Override