Enable deprecation compilation warnings

See gh-21271
This commit is contained in:
Andy Wilkinson 2020-06-04 12:58:29 +01:00
parent c64649a6d9
commit 056d5f3120
47 changed files with 182 additions and 168 deletions

View File

@ -157,7 +157,7 @@ class JavaConventions {
args.add("-parameters"); args.add("-parameters");
} }
if (JavaVersion.current() == JavaVersion.VERSION_1_8) { if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked")); args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation"));
} }
}); });
} }

View File

@ -19,16 +19,12 @@ package org.springframework.boot.actuate.autoconfigure.health;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; 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.HealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
/** /**
* Base class for configurations that can combine source beans using a * Base class for configurations that can combine source beans using a
* {@link CompositeHealthIndicator}. * {@link org.springframework.boot.actuate.health.CompositeHealthIndicator}.
* *
* @param <H> the health indicator type * @param <H> the health indicator type
* @param <S> the bean source type * @param <S> the bean source type
@ -40,15 +36,15 @@ import org.springframework.core.ResolvableType;
public abstract class CompositeHealthIndicatorConfiguration<H extends HealthIndicator, S> { public abstract class CompositeHealthIndicatorConfiguration<H extends HealthIndicator, S> {
@Autowired @Autowired
private HealthAggregator healthAggregator; private org.springframework.boot.actuate.health.HealthAggregator healthAggregator;
protected HealthIndicator createHealthIndicator(Map<String, S> beans) { protected HealthIndicator createHealthIndicator(Map<String, S> beans) {
if (beans.size() == 1) { if (beans.size() == 1) {
return createHealthIndicator(beans.values().iterator().next()); 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))); 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") @SuppressWarnings("unchecked")

View File

@ -19,11 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.health;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; 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.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
/** /**
@ -40,15 +36,16 @@ import org.springframework.core.ResolvableType;
public abstract class CompositeReactiveHealthIndicatorConfiguration<H extends ReactiveHealthIndicator, S> { public abstract class CompositeReactiveHealthIndicatorConfiguration<H extends ReactiveHealthIndicator, S> {
@Autowired @Autowired
private HealthAggregator healthAggregator; private org.springframework.boot.actuate.health.HealthAggregator healthAggregator;
protected ReactiveHealthIndicator createHealthIndicator(Map<String, S> beans) { protected ReactiveHealthIndicator createHealthIndicator(Map<String, S> beans) {
if (beans.size() == 1) { if (beans.size() == 1) {
return createHealthIndicator(beans.values().iterator().next()); 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))); 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") @SuppressWarnings("unchecked")

View File

@ -21,12 +21,12 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.boot.actuate.health.Health; 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.Status;
import org.springframework.boot.actuate.health.StatusAggregator; 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}. * {@link StatusAggregator}.
* *
* @author Phillip Webb * @author Phillip Webb
@ -34,9 +34,9 @@ import org.springframework.boot.actuate.health.StatusAggregator;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class HealthAggregatorStatusAggregatorAdapter implements StatusAggregator { 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; this.healthAggregator = healthAggregator;
} }

View File

@ -22,18 +22,18 @@ import java.util.Map;
import org.springframework.boot.actuate.health.HealthContributor; import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.boot.actuate.health.NamedContributor; import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Adapter class to convert a {@link HealthContributorRegistry} to a legacy * Adapter class to convert a {@link HealthContributorRegistry} to a legacy
* {@link HealthIndicatorRegistry}. * {@link org.springframework.boot.actuate.health.HealthIndicatorRegistry}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class HealthContributorRegistryHealthIndicatorRegistryAdapter implements HealthIndicatorRegistry { class HealthContributorRegistryHealthIndicatorRegistryAdapter
implements org.springframework.boot.actuate.health.HealthIndicatorRegistry {
private final HealthContributorRegistry contributorRegistry; private final HealthContributorRegistry contributorRegistry;

View File

@ -18,12 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.health;
import reactor.core.publisher.Mono; 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.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.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -40,13 +36,14 @@ import org.springframework.util.CollectionUtils;
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EnableConfigurationProperties(HealthIndicatorProperties.class) @EnableConfigurationProperties(org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties.class)
class LegacyHealthEndpointCompatibilityConfiguration { class LegacyHealthEndpointCompatibilityConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
HealthAggregator healthAggregator(HealthIndicatorProperties healthIndicatorProperties) { org.springframework.boot.actuate.health.HealthAggregator healthAggregator(
OrderedHealthAggregator aggregator = new OrderedHealthAggregator(); HealthIndicatorProperties healthIndicatorProperties) {
org.springframework.boot.actuate.health.OrderedHealthAggregator aggregator = new org.springframework.boot.actuate.health.OrderedHealthAggregator();
if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) { if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) {
aggregator.setStatusOrder(healthIndicatorProperties.getOrder()); aggregator.setStatusOrder(healthIndicatorProperties.getOrder());
} }
@ -54,7 +51,7 @@ class LegacyHealthEndpointCompatibilityConfiguration {
} }
@Bean @Bean
@ConditionalOnMissingBean(HealthIndicatorRegistry.class) @ConditionalOnMissingBean(org.springframework.boot.actuate.health.HealthIndicatorRegistry.class)
HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry( HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry(
HealthContributorRegistry healthContributorRegistry) { HealthContributorRegistry healthContributorRegistry) {
return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry); return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry);
@ -65,7 +62,7 @@ class LegacyHealthEndpointCompatibilityConfiguration {
static class LegacyReactiveHealthEndpointCompatibilityConfiguration { static class LegacyReactiveHealthEndpointCompatibilityConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(ReactiveHealthIndicatorRegistry.class) @ConditionalOnMissingBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class)
ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry( ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry(
ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) { ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) {
return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter( return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter(

View File

@ -23,18 +23,17 @@ import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Adapter class to convert a {@link ReactiveHealthContributorRegistry} to a legacy * Adapter class to convert a {@link ReactiveHealthContributorRegistry} to a legacy
* {@link ReactiveHealthIndicatorRegistry}. * {@link org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter
implements ReactiveHealthIndicatorRegistry { implements org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry {
private final ReactiveHealthContributorRegistry contributorRegistry; private final ReactiveHealthContributorRegistry contributorRegistry;

View File

@ -57,6 +57,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
} }
@Override @Override
@Deprecated
public TimeUnit rateUnits() { public TimeUnit rateUnits() {
return get(GangliaProperties::getRateUnits, GangliaConfig.super::rateUnits); return get(GangliaProperties::getRateUnits, GangliaConfig.super::rateUnits);
} }
@ -67,6 +68,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
} }
@Override @Override
@Deprecated
public String protocolVersion() { public String protocolVersion() {
return get(GangliaProperties::getProtocolVersion, GangliaConfig.super::protocolVersion); return get(GangliaProperties::getProtocolVersion, GangliaConfig.super::protocolVersion);
} }

View File

@ -20,7 +20,6 @@ import java.util.List;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.health.AbstractHealthAggregator;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.actuate.health.StatusAggregator;
@ -41,7 +40,7 @@ class HealthAggregatorStatusAggregatorAdapterTests {
assertThat(status.getCode()).isEqualTo("called2"); assertThat(status.getCode()).isEqualTo("called2");
} }
private static class TestHealthAggregator extends AbstractHealthAggregator { private static class TestHealthAggregator extends org.springframework.boot.actuate.health.AbstractHealthAggregator {
@Override @Override
protected Status aggregateStatus(List<Status> candidates) { protected Status aggregateStatus(List<Status> candidates) {

View File

@ -28,11 +28,9 @@ import reactor.core.publisher.Mono;
import org.springframework.boot.actuate.endpoint.SecurityContext; import org.springframework.boot.actuate.endpoint.SecurityContext;
import org.springframework.boot.actuate.endpoint.http.ApiVersion; import org.springframework.boot.actuate.endpoint.http.ApiVersion;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; 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.DefaultHealthContributorRegistry;
import org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.Health; 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.HealthComponent;
import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.HealthEndpoint; 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.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension; import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; 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.Status;
import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.actuate.health.StatusAggregator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -283,7 +280,8 @@ class HealthEndpointAutoConfigurationTests {
@Test // gh-18354 @Test // gh-18354
void runCreatesLegacyHealthAggregator() { void runCreatesLegacyHealthAggregator() {
this.contextRunner.run((context) -> { 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<String, Health> healths = new LinkedHashMap<>(); Map<String, Health> healths = new LinkedHashMap<>();
healths.put("one", Health.up().build()); healths.put("one", Health.up().build());
healths.put("two", Health.down().build()); healths.put("two", Health.down().build());
@ -294,13 +292,15 @@ class HealthEndpointAutoConfigurationTests {
@Test @Test
void runWhenReactorAvailableCreatesReactiveHealthIndicatorRegistryBean() { 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 @Test // gh-18570
void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() { void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() {
this.contextRunner.withClassLoader(new FilteredClassLoader(Mono.class.getPackage().getName())) 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 @Test
@ -337,8 +337,8 @@ class HealthEndpointAutoConfigurationTests {
static class HealthAggregatorConfiguration { static class HealthAggregatorConfiguration {
@Bean @Bean
HealthAggregator healthAggregator() { org.springframework.boot.actuate.health.HealthAggregator healthAggregator() {
return new AbstractHealthAggregator() { return new org.springframework.boot.actuate.health.AbstractHealthAggregator() {
@Override @Override
protected Status aggregateStatus(List<Status> candidates) { protected Status aggregateStatus(List<Status> candidates) {

View File

@ -23,9 +23,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; 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.actuate.health.Status;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest; 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; 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. * injected.
* *
* @author Phillip Webb * @author Phillip Webb
@ -57,16 +55,17 @@ public class HealthIndicatorRegistryInjectionIntegrationTests {
CompositeMeterRegistryAutoConfiguration.class, MetricsAutoConfiguration.class }) CompositeMeterRegistryAutoConfiguration.class, MetricsAutoConfiguration.class })
static class Config { 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) { MeterRegistry registry) {
CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(healthAggregator, org.springframework.boot.actuate.health.CompositeHealthIndicator healthIndicator = new org.springframework.boot.actuate.health.CompositeHealthIndicator(
healthIndicatorRegistry); healthAggregator, healthIndicatorRegistry);
Gauge.builder("health", healthIndicator, this::getGaugeValue) Gauge.builder("health", healthIndicator, this::getGaugeValue)
.description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN") .description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN")
.strongReference(true).register(registry); .strongReference(true).register(registry);
} }
private double getGaugeValue(CompositeHealthIndicator health) { private double getGaugeValue(org.springframework.boot.actuate.health.CompositeHealthIndicator health) {
Status status = health.health().getStatus(); Status status = health.health().getStatus();
switch (status.getCode()) { switch (status.getCode()) {
case "UP": case "UP":

View File

@ -23,6 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.web.ErrorProperties; 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.DefaultErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
@ -111,7 +112,7 @@ class ManagementErrorEndpointTests {
ErrorAttributes attributes = new ErrorAttributes() { ErrorAttributes attributes = new ErrorAttributes() {
@Override @Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
return Collections.singletonMap("message", "An error occurred"); return Collections.singletonMap("message", "An error occurred");
} }
@ -154,7 +155,7 @@ class ManagementErrorEndpointTests {
ErrorAttributes attributes = new DefaultErrorAttributes() { ErrorAttributes attributes = new DefaultErrorAttributes() {
@Override @Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
return Collections.singletonMap("error", "custom error"); return Collections.singletonMap("error", "custom error");
} }

View File

@ -158,6 +158,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
return new RequestMatchResult(patterns.iterator().next(), lookupPath, getPathMatcher()); return new RequestMatchResult(patterns.iterator().next(), lookupPath, getPathMatcher());
} }
@SuppressWarnings("deprecation")
private static RequestMappingInfo.BuilderConfiguration getBuilderConfig() { private static RequestMappingInfo.BuilderConfiguration getBuilderConfig() {
RequestMappingInfo.BuilderConfiguration config = new RequestMappingInfo.BuilderConfiguration(); RequestMappingInfo.BuilderConfiguration config = new RequestMappingInfo.BuilderConfiguration();
config.setUrlPathHelper(null); config.setUrlPathHelper(null);
@ -215,6 +216,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
HttpServletRequest.class, HttpServletResponse.class)); HttpServletRequest.class, HttpServletResponse.class));
} }
@SuppressWarnings("deprecation")
private PatternsRequestCondition patternsRequestConditionForPattern(String path) { private PatternsRequestCondition patternsRequestConditionForPattern(String path) {
String[] patterns = new String[] { this.endpointMapping.createSubPath(path) }; String[] patterns = new String[] { this.endpointMapping.createSubPath(path) };
return new PatternsRequestCondition(patterns, builderConfig.getUrlPathHelper(), builderConfig.getPathMatcher(), return new PatternsRequestCondition(patterns, builderConfig.getUrlPathHelper(), builderConfig.getPathMatcher(),

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -58,6 +58,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
* @param endpoints the web endpoints * @param endpoints the web endpoints
* @param corsConfiguration the CORS configuration for the endpoints or {@code null} * @param corsConfiguration the CORS configuration for the endpoints or {@code null}
*/ */
@SuppressWarnings("deprecation")
public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping, public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping,
Collection<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) { Collection<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) {
Assert.notNull(endpointMapping, "EndpointMapping must not be null"); Assert.notNull(endpointMapping, "EndpointMapping must not be null");
@ -102,6 +103,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern); return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern);
} }
@SuppressWarnings("deprecation")
private RequestMappingInfo withNewPatterns(RequestMappingInfo mapping, String[] patterns) { private RequestMappingInfo withNewPatterns(RequestMappingInfo mapping, String[] patterns) {
PatternsRequestCondition patternsCondition = new PatternsRequestCondition(patterns, null, null, PatternsRequestCondition patternsCondition = new PatternsRequestCondition(patterns, null, null,
useSuffixPatternMatch(), useTrailingSlashMatch(), null); useSuffixPatternMatch(), useTrailingSlashMatch(), null);

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,18 +19,20 @@ package org.springframework.boot.actuate.endpoint.web.servlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/** /**
* {@link HandlerInterceptorAdapter} to ensure that * {@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 * @author Phillip Webb
*/ */
final class SkipPathExtensionContentNegotiation extends HandlerInterceptorAdapter { 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 @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)

View File

@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; 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.EnableElasticsearchRepositories;
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories; import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
@ -38,7 +38,7 @@ import org.springframework.data.elasticsearch.repository.config.EnableReactiveEl
* @since 1.1.0 * @since 1.1.0
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ElasticsearchTemplate.class }) @ConditionalOnClass({ ElasticsearchRestTemplate.class })
@AutoConfigureAfter({ ElasticsearchRestClientAutoConfiguration.class, @AutoConfigureAfter({ ElasticsearchRestClientAutoConfiguration.class,
ReactiveElasticsearchRestClientAutoConfiguration.class }) ReactiveElasticsearchRestClientAutoConfiguration.class })
@Import({ ElasticsearchDataConfiguration.BaseConfiguration.class, @Import({ ElasticsearchDataConfiguration.BaseConfiguration.class,

View File

@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.integration;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import javax.sql.DataSource; import javax.sql.DataSource;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
@ -156,8 +155,9 @@ public class IntegrationAutoConfiguration {
/** /**
* Integration RSocket configuration. * Integration RSocket configuration.
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, RSocketFactory.class }) @ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, io.rsocket.RSocketFactory.class })
@Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class) @Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class)
protected static class IntegrationRSocketConfiguration { protected static class IntegrationRSocketConfiguration {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,12 +18,12 @@ package org.springframework.boot.autoconfigure.jms.artemis;
import java.io.File; 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.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; 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.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.JournalType;
@ -77,7 +77,7 @@ class ArtemisEmbeddedConfigurationFactory {
private CoreAddressConfiguration createAddressConfiguration(String name) { private CoreAddressConfiguration createAddressConfiguration(String name) {
return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration( 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() { private String getDataDir() {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.jms.artemis;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; 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.api.core.RoutingType;
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; 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.core.server.embedded.EmbeddedActiveMQ;
import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; import org.apache.activemq.artemis.jms.server.config.JMSConfiguration;
import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration;
@ -71,7 +71,7 @@ class ArtemisEmbeddedServerConfiguration {
String queueName = queueConfiguration.getName(); String queueName = queueConfiguration.getName();
configuration.addAddressConfiguration( configuration.addAddressConfiguration(
new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST) new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST)
.addQueueConfiguration(new CoreQueueConfiguration().setAddress(queueName).setName(queueName) .addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName)
.setFilterString(queueConfiguration.getSelector()) .setFilterString(queueConfiguration.getSelector())
.setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST))); .setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST)));
} }

View File

@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.rsocket; package org.springframework.boot.autoconfigure.rsocket;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
@ -37,8 +36,9 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class }) @ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, TcpServerTransport.class })
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
public class RSocketMessagingAutoConfiguration { public class RSocketMessagingAutoConfiguration {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.rsocket; package org.springframework.boot.autoconfigure.rsocket;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import reactor.netty.http.server.HttpServer; import reactor.netty.http.server.HttpServer;
@ -40,8 +39,10 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @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) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
public class RSocketRequesterAutoConfiguration { public class RSocketRequesterAutoConfiguration {

View File

@ -38,7 +38,6 @@ import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory; import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.RSocketServerFactory; 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.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -72,7 +71,8 @@ public class RSocketServerAutoConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties, RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties,
RSocketMessageHandler messageHandler, ObjectProvider<ServerRSocketFactoryProcessor> processors, RSocketMessageHandler messageHandler,
ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
ObjectProvider<RSocketServerCustomizer> customizers) { ObjectProvider<RSocketServerCustomizer> customizers) {
return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(), return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(),
messageHandler.responder(), processors.orderedStream(), customizers.orderedStream()); messageHandler.responder(), processors.orderedStream(), customizers.orderedStream());
@ -94,7 +94,7 @@ public class RSocketServerAutoConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory, RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory,
ObjectProvider<ServerRSocketFactoryProcessor> processors, ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
ObjectProvider<RSocketServerCustomizer> customizers) { ObjectProvider<RSocketServerCustomizer> customizers) {
NettyRSocketServerFactory factory = new NettyRSocketServerFactory(); NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
factory.setResourceFactory(resourceFactory); factory.setResourceFactory(resourceFactory);

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory; import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import io.netty.buffer.PooledByteBufAllocator; import io.netty.buffer.PooledByteBufAllocator;
import io.rsocket.RSocketFactory;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
@ -48,8 +47,9 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher;
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class }) @ConditionalOnClass({ io.rsocket.RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class })
@AutoConfigureAfter(JacksonAutoConfiguration.class) @AutoConfigureAfter(JacksonAutoConfiguration.class)
public class RSocketStrategiesAutoConfiguration { public class RSocketStrategiesAutoConfiguration {

View File

@ -20,7 +20,6 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import io.rsocket.RSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.core.RSocketServer; import io.rsocket.core.RSocketServer;
import io.rsocket.transport.ServerTransport; import io.rsocket.transport.ServerTransport;
@ -28,7 +27,6 @@ import io.rsocket.transport.netty.server.WebsocketRouteTransport;
import reactor.netty.http.server.HttpServerRoutes; import reactor.netty.http.server.HttpServerRoutes;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.boot.web.embedded.netty.NettyRouteProvider; import org.springframework.boot.web.embedded.netty.NettyRouteProvider;
/** /**
@ -43,12 +41,13 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
private final SocketAcceptor socketAcceptor; private final SocketAcceptor socketAcceptor;
private final List<ServerRSocketFactoryProcessor> processors; private final List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors;
private final List<RSocketServerCustomizer> customizers; private final List<RSocketServerCustomizer> customizers;
RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor, RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor,
Stream<ServerRSocketFactoryProcessor> processors, Stream<RSocketServerCustomizer> customizers) { Stream<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
Stream<RSocketServerCustomizer> customizers) {
this.mappingPath = mappingPath; this.mappingPath = mappingPath;
this.socketAcceptor = socketAcceptor; this.socketAcceptor = socketAcceptor;
this.processors = processors.collect(Collectors.toList()); this.processors = processors.collect(Collectors.toList());
@ -58,7 +57,8 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
@Override @Override
public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) { public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) {
RSocketServer server = RSocketServer.create(this.socketAcceptor); 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.processors.forEach((processor) -> processor.process(factory));
this.customizers.forEach((customizer) -> customizer.customize(server)); this.customizers.forEach((customizer) -> customizer.customize(server));
ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor(); ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor();

View File

@ -34,9 +34,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jdbc.XADataSourceWrapper; import org.springframework.boot.jdbc.XADataSourceWrapper;
import org.springframework.boot.jms.XAConnectionFactoryWrapper; 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.boot.system.ApplicationHome;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -92,14 +89,14 @@ class BitronixJtaConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class) @ConditionalOnMissingBean(XADataSourceWrapper.class)
BitronixXADataSourceWrapper xaDataSourceWrapper() { org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper xaDataSourceWrapper() {
return new BitronixXADataSourceWrapper(); return new org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper();
} }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
static BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() { static org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() {
return new BitronixDependentBeanFactoryPostProcessor(); return new org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor();
} }
@Bean @Bean
@ -116,8 +113,8 @@ class BitronixJtaConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(XAConnectionFactoryWrapper.class) @ConditionalOnMissingBean(XAConnectionFactoryWrapper.class)
BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() { org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
return new BitronixXAConnectionFactoryWrapper(); return new org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper();
} }
} }

View File

@ -82,7 +82,6 @@ import org.springframework.validation.Validator;
import org.springframework.web.HttpMediaTypeNotAcceptableException; import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ContentNegotiationStrategy;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
@ -499,13 +498,14 @@ public class WebMvcAutoConfiguration {
@Bean @Bean
@Override @Override
@SuppressWarnings("deprecation")
public ContentNegotiationManager mvcContentNegotiationManager() { public ContentNegotiationManager mvcContentNegotiationManager() {
ContentNegotiationManager manager = super.mvcContentNegotiationManager(); ContentNegotiationManager manager = super.mvcContentNegotiationManager();
List<ContentNegotiationStrategy> strategies = manager.getStrategies(); List<ContentNegotiationStrategy> strategies = manager.getStrategies();
ListIterator<ContentNegotiationStrategy> iterator = strategies.listIterator(); ListIterator<ContentNegotiationStrategy> iterator = strategies.listIterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ContentNegotiationStrategy strategy = iterator.next(); ContentNegotiationStrategy strategy = iterator.next();
if (strategy instanceof PathExtensionContentNegotiationStrategy) { if (strategy instanceof org.springframework.web.accept.PathExtensionContentNegotiationStrategy) {
iterator.set(new OptionalPathExtensionContentNegotiationStrategy(strategy)); iterator.set(new OptionalPathExtensionContentNegotiationStrategy(strategy));
} }
} }
@ -577,12 +577,15 @@ public class WebMvcAutoConfiguration {
} }
/** /**
* Decorator to make {@link PathExtensionContentNegotiationStrategy} optional * Decorator to make
* depending on a request attribute. * {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy}
* optional depending on a request attribute.
*/ */
static class OptionalPathExtensionContentNegotiationStrategy implements ContentNegotiationStrategy { 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; private final ContentNegotiationStrategy delegate;

View File

@ -82,6 +82,7 @@ public class BasicErrorController extends AbstractErrorController {
} }
@Override @Override
@Deprecated
public String getErrorPath() { public String getErrorPath() {
return null; return null;
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -43,7 +43,7 @@ public class JettyWebSocketServletWebServerCustomizer
@Override @Override
public void configure(WebAppContext context) throws Exception { public void configure(WebAppContext context) throws Exception {
ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(context); ServerContainer serverContainer = WebSocketServerContainerInitializer.initialize(context);
ShutdownThread.deregister(serverContainer); ShutdownThread.deregister(serverContainer);
} }

View File

@ -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.HttpHandlerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration; 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.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext; import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext;
@ -109,7 +108,8 @@ class RSocketWebSocketNettyRouteProviderTests {
} }
@Bean @Bean
ServerRSocketFactoryProcessor myRSocketFactoryProcessor() { @SuppressWarnings("deprecation")
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor myRSocketFactoryProcessor() {
return (server) -> { return (server) -> {
processorCallCount++; processorCallCount++;
return server; return server;

View File

@ -47,9 +47,6 @@ import org.springframework.boot.jms.XAConnectionFactoryWrapper;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor; import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor;
import org.springframework.boot.jta.atomikos.AtomikosProperties; 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.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -71,7 +68,7 @@ import static org.mockito.Mockito.mock;
* @author Kazuki Shimizu * @author Kazuki Shimizu
* @author Nishant Raut * @author Nishant Raut
*/ */
@SuppressWarnings("deprecation") // @SuppressWarnings("deprecation")
class JtaAutoConfigurationTests { class JtaAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@ -123,7 +120,7 @@ class JtaAutoConfigurationTests {
this.context.getBean(TransactionManager.class); this.context.getBean(TransactionManager.class);
this.context.getBean(XADataSourceWrapper.class); this.context.getBean(XADataSourceWrapper.class);
this.context.getBean(XAConnectionFactoryWrapper.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); this.context.getBean(JtaTransactionManager.class);
} }
@ -178,7 +175,8 @@ class JtaAutoConfigurationTests {
"spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context); "spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context);
this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); 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.getMinPoolSize()).isEqualTo(5);
assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10); assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10);
} }
@ -205,7 +203,8 @@ class JtaAutoConfigurationTests {
.applyTo(this.context); .applyTo(this.context);
this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); 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.getMinPoolSize()).isEqualTo(5);
assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); assertThat(dataSource.getMaxPoolSize()).isEqualTo(10);
} }

View File

@ -145,13 +145,13 @@ class ServerPropertiesTests {
assertThat(accesslog.isRenameOnRotate()).isTrue(); assertThat(accesslog.isRenameOnRotate()).isTrue();
assertThat(accesslog.isIpv6Canonical()).isTrue(); assertThat(accesslog.isIpv6Canonical()).isTrue();
assertThat(accesslog.isRequestAttributesEnabled()).isTrue(); assertThat(accesslog.isRequestAttributesEnabled()).isTrue();
assertThat(tomcat.getRemoteIpHeader()).isEqualTo("Remote-Ip"); assertThat(tomcat.getRemoteip().getRemoteIpHeader()).isEqualTo("Remote-Ip");
assertThat(tomcat.getProtocolHeader()).isEqualTo("X-Forwarded-Protocol"); assertThat(tomcat.getRemoteip().getProtocolHeader()).isEqualTo("X-Forwarded-Protocol");
assertThat(tomcat.getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); assertThat(tomcat.getRemoteip().getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10); assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10);
assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<'); assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<');
assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|'); assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|');
assertThat(tomcat.getUseRelativeRedirects()).isTrue(); assertThat(tomcat.isUseRelativeRedirects()).isTrue();
} }
@Test @Test
@ -444,13 +444,13 @@ class ServerPropertiesTests {
@Test @Test
void tomcatInternalProxiesMatchesDefault() { void tomcatInternalProxiesMatchesDefault() {
assertThat(this.properties.getTomcat().getInternalProxies()) assertThat(this.properties.getTomcat().getRemoteip().getInternalProxies())
.isEqualTo(new RemoteIpValve().getInternalProxies()); .isEqualTo(new RemoteIpValve().getInternalProxies());
} }
@Test @Test
void tomcatUseRelativeRedirectsDefaultsToFalse() { void tomcatUseRelativeRedirectsDefaultsToFalse() {
assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse(); assertThat(this.properties.getTomcat().isUseRelativeRedirects()).isFalse();
} }
@Test @Test

View File

@ -233,9 +233,10 @@ class JettyWebServerFactoryCustomizerTests {
assertThat(threadPool).isInstanceOf(QueuedThreadPool.class); assertThat(threadPool).isInstanceOf(QueuedThreadPool.class);
QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool; QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool;
Jetty defaultProperties = new Jetty(); Jetty defaultProperties = new Jetty();
assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getMinThreads()); assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getThreads().getMin());
assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getMaxThreads()); assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getThreads().getMax());
assertThat(queuedThreadPool.getIdleTimeout()).isEqualTo(defaultProperties.getThreadIdleTimeout().toMillis()); assertThat(queuedThreadPool.getIdleTimeout())
.isEqualTo(defaultProperties.getThreads().getIdleTimeout().toMillis());
} }
private CustomRequestLog getRequestLog(JettyWebServer server) { private CustomRequestLog getRequestLog(JettyWebServer server) {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -84,7 +84,7 @@ class TomcatServletWebServerFactoryCustomizerTests {
@Test @Test
void useRelativeRedirectsCanBeConfigured() { void useRelativeRedirectsCanBeConfigured() {
bind("server.tomcat.use-relative-redirects=true"); bind("server.tomcat.use-relative-redirects=true");
assertThat(this.serverProperties.getTomcat().getUseRelativeRedirects()).isTrue(); assertThat(this.serverProperties.getTomcat().isUseRelativeRedirects()).isTrue();
TomcatWebServer server = customizeAndGetServer(); TomcatWebServer server = customizeAndGetServer();
Context context = (Context) server.getTomcat().getHost().findChildren()[0]; Context context = (Context) server.getTomcat().getHost().findChildren()[0];
assertThat(context.getUseRelativeRedirects()).isTrue(); assertThat(context.getUseRelativeRedirects()).isTrue();

View File

@ -77,7 +77,6 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ContentNegotiationStrategy;
import org.springframework.web.accept.ParameterContentNegotiationStrategy; import org.springframework.web.accept.ParameterContentNegotiationStrategy;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@ -744,6 +743,7 @@ class WebMvcAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void defaultPathMatching() { void defaultPathMatching() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class); RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
@ -754,6 +754,7 @@ class WebMvcAutoConfigurationTests {
@Test @Test
@Deprecated @Deprecated
@SuppressWarnings("deprecation")
void useSuffixPatternMatch() { void useSuffixPatternMatch() {
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true", this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
"spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> { "spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> {
@ -807,12 +808,15 @@ class WebMvcAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void contentNegotiationStrategySkipsPathExtension() throws Exception { void contentNegotiationStrategySkipsPathExtension() throws Exception {
ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class); ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class);
ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy( ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy(
delegate); delegate);
MockHttpServletRequest request = new MockHttpServletRequest(); 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); ServletWebRequest webRequest = new ServletWebRequest(request);
List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest); List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest);
assertThat(mediaTypes).containsOnly(MediaType.ALL); assertThat(mediaTypes).containsOnly(MediaType.ALL);
@ -1128,6 +1132,7 @@ class WebMvcAutoConfigurationTests {
static class CustomConfigurer implements WebMvcConfigurer { static class CustomConfigurer implements WebMvcConfigurer {
@Override @Override
@SuppressWarnings("deprecation")
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(true); configurer.favorPathExtension(true);
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,8 +35,6 @@ import org.apache.maven.model.Repository;
import org.apache.maven.model.building.DefaultModelBuilder; import org.apache.maven.model.building.DefaultModelBuilder;
import org.apache.maven.model.building.DefaultModelBuilderFactory; import org.apache.maven.model.building.DefaultModelBuilderFactory;
import org.apache.maven.model.building.DefaultModelBuildingRequest; 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.InvalidRepositoryException;
import org.apache.maven.model.resolution.ModelResolver; import org.apache.maven.model.resolution.ModelResolver;
import org.apache.maven.model.resolution.UnresolvableModelException; import org.apache.maven.model.resolution.UnresolvableModelException;
@ -167,7 +165,7 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
try { try {
DefaultModelBuildingRequest request = new DefaultModelBuildingRequest(); DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
request.setModelResolver(new GrapeModelResolver()); 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()); request.setSystemProperties(System.getProperties());
Model model = modelBuilder.build(request).getEffectiveModel(); Model model = modelBuilder.build(request).getEffectiveModel();
this.resolutionContext.addDependencyManagement(new MavenModelDependencyManagement(model)); this.resolutionContext.addDependencyManagement(new MavenModelDependencyManagement(model));
@ -197,25 +195,28 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
private static class GrapeModelResolver implements ModelResolver { private static class GrapeModelResolver implements ModelResolver {
@Override @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()); return resolveModel(parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
} }
@Override @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()); return resolveModel(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion());
} }
@Override @Override
public ModelSource resolveModel(String groupId, String artifactId, String version) public org.apache.maven.model.building.ModelSource resolveModel(String groupId, String artifactId,
throws UnresolvableModelException { String version) throws UnresolvableModelException {
Map<String, String> dependency = new HashMap<>(); Map<String, String> dependency = new HashMap<>();
dependency.put("group", groupId); dependency.put("group", groupId);
dependency.put("module", artifactId); dependency.put("module", artifactId);
dependency.put("version", version); dependency.put("version", version);
dependency.put("type", "pom"); dependency.put("type", "pom");
try { 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) { catch (MalformedURLException ex) {
throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version); throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version);

View File

@ -16,7 +16,6 @@
package org.springframework.boot.test.mock.mockito; package org.springframework.boot.test.mock.mockito;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -333,8 +332,8 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
} }
@Override @Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, final Object bean, public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
String beanName) throws BeansException { throws BeansException {
ReflectionUtils.doWithFields(bean.getClass(), (field) -> postProcessField(bean, field)); ReflectionUtils.doWithFields(bean.getClass(), (field) -> postProcessField(bean, field));
return pvs; return pvs;
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,12 +19,11 @@ package org.springframework.boot.gradle.plugin;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.maven.MavenResolver;
import org.gradle.api.plugins.MavenPlugin;
import org.gradle.api.tasks.Upload; 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 * @author Andy Wilkinson
*/ */
@ -37,8 +36,9 @@ final class MavenPluginAction implements PluginApplicationAction {
} }
@Override @Override
@SuppressWarnings("deprecation")
public Class<? extends Plugin<? extends Project>> getPluginClass() { public Class<? extends Plugin<? extends Project>> getPluginClass() {
return MavenPlugin.class; return org.gradle.api.plugins.MavenPlugin.class;
} }
@Override @Override
@ -50,8 +50,9 @@ final class MavenPluginAction implements PluginApplicationAction {
}); });
} }
@SuppressWarnings("deprecation")
private void clearConfigurationMappings(Upload upload) { 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()); (resolver) -> resolver.getPom().getScopeMappings().getMappings().clear());
} }

View File

@ -208,11 +208,13 @@ public class BootJar extends Jar implements BootArchive {
} }
@Override @Override
@Deprecated
public boolean isExcludeDevtools() { public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools(); return this.support.isExcludeDevtools();
} }
@Override @Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) { public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools); this.support.setExcludeDevtools(excludeDevtools);
} }

View File

@ -165,11 +165,13 @@ public class BootWar extends War implements BootArchive {
} }
@Override @Override
@Deprecated
public boolean isExcludeDevtools() { public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools(); return this.support.isExcludeDevtools();
} }
@Override @Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) { public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools); this.support.setExcludeDevtools(excludeDevtools);
} }

View File

@ -81,6 +81,7 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> {
} }
@Test @Test
@Deprecated
void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException { void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException {
getTask().setMainClassName("com.example.Main"); getTask().setMainClassName("com.example.Main");
getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar")); getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar"));

View File

@ -103,6 +103,7 @@ public class ExplodedArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return new EntryIterator(this.root, this.recursive, null, null); return new EntryIterator(this.root, this.recursive, null, null);
} }
@ -321,6 +322,7 @@ public class ExplodedArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return Collections.emptyIterator(); return Collections.emptyIterator();
} }

View File

@ -81,6 +81,7 @@ public class JarFileArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return new EntryIterator(this.jarFile.iterator(), null, null); return new EntryIterator(this.jarFile.iterator(), null, null);
} }

View File

@ -25,6 +25,7 @@ import java.net.URLClassLoader;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.Attributes; import java.util.jar.Attributes;
@ -289,7 +290,7 @@ class PropertiesLauncherTests {
assertThat(loader.getClass().getName()).isEqualTo(TestLoader.class.getName()); assertThat(loader.getClass().getName()).isEqualTo(TestLoader.class.getName());
} }
private List<Archive> archives() throws Exception { private Iterator<Archive> archives() throws Exception {
List<Archive> archives = new ArrayList<>(); List<Archive> archives = new ArrayList<>();
String path = System.getProperty("java.class.path"); String path = System.getProperty("java.class.path");
for (String url : path.split(File.pathSeparator)) { for (String url : path.split(File.pathSeparator)) {
@ -298,7 +299,7 @@ class PropertiesLauncherTests {
archives.add(archive); archives.add(archive);
} }
} }
return archives; return archives.iterator();
} }
private Archive archive(String url) throws IOException { private Archive archive(String url) throws IOException {

View File

@ -148,6 +148,7 @@ class JarFileArchiveTests {
File file = new File(this.tempDir, "test.jar"); File file = new File(this.tempDir, "test.jar");
FileCopyUtils.copy(writeZip64Jar(), file); FileCopyUtils.copy(writeZip64Jar(), file);
try (JarFileArchive zip64Archive = new JarFileArchive(file)) { try (JarFileArchive zip64Archive = new JarFileArchive(file)) {
@SuppressWarnings("deprecation")
Iterator<Entry> entries = zip64Archive.iterator(); Iterator<Entry> entries = zip64Archive.iterator();
for (int i = 0; i < 65537; i++) { for (int i = 0; i < 65537; i++) {
assertThat(entries.hasNext()).as(i + "nth file is present").isTrue(); assertThat(entries.hasNext()).as(i + "nth file is present").isTrue();

View File

@ -24,8 +24,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import io.rsocket.RSocketFactory;
import io.rsocket.RSocketFactory.ServerRSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.transport.ServerTransport; import io.rsocket.transport.ServerTransport;
import io.rsocket.transport.netty.server.CloseableChannel; 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.RSocketServer;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.RSocketServerFactory; import org.springframework.boot.rsocket.server.RSocketServerFactory;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.http.client.reactive.ReactorResourceFactory; import org.springframework.http.client.reactive.ReactorResourceFactory;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -62,7 +59,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
private Duration lifecycleTimeout; private Duration lifecycleTimeout;
private List<ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>(); @SuppressWarnings("deprecation")
private List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>();
private List<RSocketServerCustomizer> rSocketServerCustomizers = new ArrayList<>(); private List<RSocketServerCustomizer> rSocketServerCustomizers = new ArrayList<>();
@ -90,29 +88,32 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
} }
/** /**
* Set {@link ServerRSocketFactoryProcessor}s that should be called to process the * Set {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
* {@link ServerRSocketFactory} while building the server. Calling this method will * that should be called to process the
* replace any existing processors. * {@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 * @param socketFactoryProcessors processors to apply before the server starts
* @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of * @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of
* 2.2.7 * 2.2.7
*/ */
@Deprecated @Deprecated
public void setSocketFactoryProcessors( public void setSocketFactoryProcessors(
Collection<? extends ServerRSocketFactoryProcessor> socketFactoryProcessors) { Collection<? extends org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors) {
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors); this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors);
} }
/** /**
* Add {@link ServerRSocketFactoryProcessor}s that should be called to process the * Add {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
* {@link ServerRSocketFactory} while building the server. * 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 * @param socketFactoryProcessors processors to apply before the server starts
* @deprecated in favor of * @deprecated in favor of
* {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7 * {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7
*/ */
@Deprecated @Deprecated
public void addSocketFactoryProcessors(ServerRSocketFactoryProcessor... socketFactoryProcessors) { public void addSocketFactoryProcessors(
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor... socketFactoryProcessors) {
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors)); this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors));
} }
@ -154,7 +155,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
public NettyRSocketServer create(SocketAcceptor socketAcceptor) { public NettyRSocketServer create(SocketAcceptor socketAcceptor) {
ServerTransport<CloseableChannel> transport = createTransport(); ServerTransport<CloseableChannel> transport = createTransport();
io.rsocket.core.RSocketServer server = io.rsocket.core.RSocketServer.create(socketAcceptor); 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.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server));
this.socketFactoryProcessors.forEach((processor) -> processor.process(factory)); this.socketFactoryProcessors.forEach((processor) -> processor.process(factory));
Mono<CloseableChannel> starter = server.bind(transport); Mono<CloseableChannel> starter = server.bind(transport);

View File

@ -16,10 +16,9 @@
package org.springframework.boot.rsocket.server; 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. * RSocketFactory.ServerRSocketFactory} before it is used.
* *
* @author Brian Clozel * @author Brian Clozel
@ -37,6 +36,6 @@ public interface ServerRSocketFactoryProcessor {
* @param factory the factory to process * @param factory the factory to process
* @return the processed factory instance * @return the processed factory instance
*/ */
ServerRSocketFactory process(ServerRSocketFactory factory); io.rsocket.RSocketFactory.ServerRSocketFactory process(io.rsocket.RSocketFactory.ServerRSocketFactory factory);
} }

View File

@ -25,7 +25,6 @@ import io.netty.buffer.PooledByteBufAllocator;
import io.rsocket.ConnectionSetupPayload; import io.rsocket.ConnectionSetupPayload;
import io.rsocket.Payload; import io.rsocket.Payload;
import io.rsocket.RSocket; import io.rsocket.RSocket;
import io.rsocket.RSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.transport.netty.client.WebsocketClientTransport; import io.rsocket.transport.netty.client.WebsocketClientTransport;
import io.rsocket.util.DefaultPayload; 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.RSocketServer;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; 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.CharSequenceEncoder;
import org.springframework.core.codec.StringDecoder; import org.springframework.core.codec.StringDecoder;
import org.springframework.core.io.buffer.NettyDataBufferFactory; import org.springframework.core.io.buffer.NettyDataBufferFactory;
@ -131,20 +129,20 @@ class NettyRSocketServerFactoryTests {
} }
@Test @Test
@SuppressWarnings("deprecation") @Deprecated
void serverProcessors() { void serverProcessors() {
NettyRSocketServerFactory factory = getFactory(); 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++) { for (int i = 0; i < processors.length; i++) {
processors[i] = mock(ServerRSocketFactoryProcessor.class); processors[i] = mock(org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor.class);
given(processors[i].process(any(RSocketFactory.ServerRSocketFactory.class))) given(processors[i].process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class)))
.will((invocation) -> invocation.getArgument(0)); .will((invocation) -> invocation.getArgument(0));
} }
factory.setSocketFactoryProcessors(Arrays.asList(processors)); factory.setSocketFactoryProcessors(Arrays.asList(processors));
this.server = factory.create(new EchoRequestResponseAcceptor()); this.server = factory.create(new EchoRequestResponseAcceptor());
InOrder ordered = inOrder((Object[]) processors); InOrder ordered = inOrder((Object[]) processors);
for (ServerRSocketFactoryProcessor processor : processors) { for (org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor processor : processors) {
ordered.verify(processor).process(any(RSocketFactory.ServerRSocketFactory.class)); ordered.verify(processor).process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class));
} }
} }
@ -200,6 +198,7 @@ class NettyRSocketServerFactoryTests {
static class EchoRequestResponseAcceptor implements SocketAcceptor { static class EchoRequestResponseAcceptor implements SocketAcceptor {
@Override @Override
@SuppressWarnings("deprecation")
public Mono<RSocket> accept(ConnectionSetupPayload setupPayload, RSocket rSocket) { public Mono<RSocket> accept(ConnectionSetupPayload setupPayload, RSocket rSocket) {
return Mono.just(new RSocket() { return Mono.just(new RSocket() {
@Override @Override