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