commit
9e08490522
|
|
@ -25,6 +25,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import io.spring.javaformat.gradle.FormatTask;
|
||||
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
||||
|
|
@ -56,7 +57,13 @@ import org.springframework.boot.build.testing.TestFailuresPlugin;
|
|||
* <li>{@link Test} tasks are configured to use JUnit Platform and use a max heap of 1024M
|
||||
* <li>{@link JavaCompile}, {@link Javadoc}, and {@link FormatTask} tasks are configured
|
||||
* to use UTF-8 encoding
|
||||
* <li>{@link JavaCompile} tasks are configured to use {@code -parameters}
|
||||
* <li>{@link JavaCompile} tasks are configured to use {@code -parameters} and, when
|
||||
* compiling with Java 8, to:
|
||||
* <ul>
|
||||
* <li>Treat warnings as errors
|
||||
* <li>Enable {@code unchecked}, {@code deprecation}, {@code rawtypes}, and {@code varags}
|
||||
* warnings
|
||||
* </ul>
|
||||
* <li>{@link Jar} tasks are configured to produce jars with LICENSE.txt and NOTICE.txt
|
||||
* files and the following manifest entries:
|
||||
* <ul>
|
||||
|
|
@ -149,6 +156,10 @@ class JavaConventions {
|
|||
if (!args.contains("-parameters")) {
|
||||
args.add("-parameters");
|
||||
}
|
||||
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
|
||||
args.addAll(Arrays.asList("-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes",
|
||||
"-Xlint:varargs"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -49,6 +49,7 @@ public abstract class ManagementWebServerFactoryCustomizer<T extends Configurabl
|
|||
private final Class<? extends WebServerFactoryCustomizer<?>>[] customizerClasses;
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
protected ManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory,
|
||||
Class<? extends WebServerFactoryCustomizer<?>>... customizerClasses) {
|
||||
this.beanFactory = beanFactory;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoCo
|
|||
import org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType;
|
||||
|
|
@ -208,7 +207,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
|
|||
.run((context) -> {
|
||||
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(context);
|
||||
Collection<ExposableWebEndpoint> endpoints = handlerMapping.getEndpoints();
|
||||
List<EndpointId> endpointIds = endpoints.stream().map(ExposableEndpoint::getEndpointId)
|
||||
List<EndpointId> endpointIds = endpoints.stream().map(ExposableWebEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
assertThat(endpointIds).contains(EndpointId.of("test"));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -47,12 +47,12 @@ class JerseyEndpointIntegrationTests {
|
|||
|
||||
@Test
|
||||
void linksAreProvidedToAllEndpointTypes() {
|
||||
testJerseyEndpoints(new Class[] { EndpointsConfiguration.class, ResourceConfigConfiguration.class });
|
||||
testJerseyEndpoints(new Class<?>[] { EndpointsConfiguration.class, ResourceConfigConfiguration.class });
|
||||
}
|
||||
|
||||
@Test
|
||||
void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() {
|
||||
testJerseyEndpoints(new Class[] { EndpointsConfiguration.class });
|
||||
testJerseyEndpoints(new Class<?>[] { EndpointsConfiguration.class });
|
||||
}
|
||||
|
||||
protected void testJerseyEndpoints(Class<?>[] userConfigurations) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,7 +25,6 @@ import java.util.stream.Collectors;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.DiscoveredEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
|
|
@ -114,7 +113,7 @@ class ControllerEndpointDiscovererTests {
|
|||
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
|
||||
.run(assertDiscoverer((discoverer) -> {
|
||||
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableEndpoint::getEndpointId)
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableControllerEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
assertThat(ids).containsOnly(EndpointId.of("testcontroller"), EndpointId.of("testrestcontroller"));
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -32,7 +32,6 @@ import javax.servlet.ServletResponse;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.DiscoveredEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
|
|
@ -97,7 +96,7 @@ class ServletEndpointDiscovererTests {
|
|||
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
|
||||
.run(assertDiscoverer((discoverer) -> {
|
||||
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableEndpoint::getEndpointId)
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableServletEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
assertThat(ids).containsOnly(EndpointId.of("testservlet"));
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -89,9 +89,10 @@ class HttpTraceWebFilterTests {
|
|||
executeFilter(new ServerWebExchangeDecorator(
|
||||
MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com"))) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Mono<Principal> getPrincipal() {
|
||||
return Mono.just(principal);
|
||||
public <T extends Principal> Mono<T> getPrincipal() {
|
||||
return Mono.just((T) principal);
|
||||
}
|
||||
|
||||
}, (exchange) -> {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import org.springframework.beans.factory.BeanCreationException;
|
|||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider;
|
||||
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider.MockCacheManager;
|
||||
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
|
|
@ -354,8 +355,9 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
|
|||
assertThat(cacheManager.getCacheNames()).containsOnly("one", "two");
|
||||
CompleteConfiguration<?, ?> defaultCacheConfiguration = context
|
||||
.getBean(CompleteConfiguration.class);
|
||||
verify(cacheManager.getCacheManager()).createCache("one", defaultCacheConfiguration);
|
||||
verify(cacheManager.getCacheManager()).createCache("two", defaultCacheConfiguration);
|
||||
MockCacheManager mockCacheManager = (MockCacheManager) cacheManager.getCacheManager();
|
||||
assertThat(mockCacheManager.getConfigurations()).containsEntry("one", defaultCacheConfiguration)
|
||||
.containsEntry("two", defaultCacheConfiguration);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -27,8 +27,6 @@ import javax.cache.configuration.Configuration;
|
|||
import javax.cache.configuration.OptionalFeature;
|
||||
import javax.cache.spi.CachingProvider;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
|
@ -41,25 +39,8 @@ import static org.mockito.Mockito.mock;
|
|||
public class MockCachingProvider implements CachingProvider {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
|
||||
CacheManager cacheManager = mock(CacheManager.class);
|
||||
given(cacheManager.getURI()).willReturn(uri);
|
||||
given(cacheManager.getClassLoader()).willReturn(classLoader);
|
||||
final Map<String, Cache> caches = new HashMap<>();
|
||||
given(cacheManager.getCacheNames()).willReturn(caches.keySet());
|
||||
given(cacheManager.getCache(anyString())).willAnswer((invocation) -> {
|
||||
String cacheName = invocation.getArgument(0);
|
||||
return caches.get(cacheName);
|
||||
});
|
||||
given(cacheManager.createCache(anyString(), any(Configuration.class))).will((invocation) -> {
|
||||
String cacheName = invocation.getArgument(0);
|
||||
Cache cache = mock(Cache.class);
|
||||
given(cache.getName()).willReturn(cacheName);
|
||||
caches.put(cacheName, cache);
|
||||
return cache;
|
||||
});
|
||||
return cacheManager;
|
||||
return new MockCacheManager(uri, classLoader, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -104,4 +85,108 @@ public class MockCachingProvider implements CachingProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static class MockCacheManager implements CacheManager {
|
||||
|
||||
private final Map<String, Configuration<?, ?>> configurations = new HashMap<>();
|
||||
|
||||
private final Map<String, Cache<?, ?>> caches = new HashMap<>();
|
||||
|
||||
private final URI uri;
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
private final Properties properties;
|
||||
|
||||
private boolean closed;
|
||||
|
||||
public MockCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
|
||||
this.uri = uri;
|
||||
this.classLoader = classLoader;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachingProvider getCachingProvider() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getURI() {
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return this.classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String cacheName, C configuration)
|
||||
throws IllegalArgumentException {
|
||||
this.configurations.put(cacheName, configuration);
|
||||
Cache<K, V> cache = mock(Cache.class);
|
||||
given(cache.getName()).willReturn(cacheName);
|
||||
this.caches.put(cacheName, cache);
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> Cache<K, V> getCache(String cacheName, Class<K> keyType, Class<V> valueType) {
|
||||
return (Cache<K, V>) this.caches.get(cacheName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> Cache<K, V> getCache(String cacheName) {
|
||||
return (Cache<K, V>) this.caches.get(cacheName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getCacheNames() {
|
||||
return this.caches.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyCache(String cacheName) {
|
||||
this.caches.remove(cacheName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableManagement(String cacheName, boolean enabled) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableStatistics(String cacheName, boolean enabled) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
this.closed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClosed() {
|
||||
return this.closed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> clazz) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Map<String, Configuration<?, ?>> getConfigurations() {
|
||||
return this.configurations;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -46,13 +46,13 @@ class ConfigurationPropertiesAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
void processAnnotatedBean() {
|
||||
load(new Class[] { AutoConfig.class, SampleBean.class }, "foo.name:test");
|
||||
load(new Class<?>[] { AutoConfig.class, SampleBean.class }, "foo.name:test");
|
||||
assertThat(this.context.getBean(SampleBean.class).getName()).isEqualTo("test");
|
||||
}
|
||||
|
||||
@Test
|
||||
void processAnnotatedBeanNoAutoConfig() {
|
||||
load(new Class[] { SampleBean.class }, "foo.name:test");
|
||||
load(new Class<?>[] { SampleBean.class }, "foo.name:test");
|
||||
assertThat(this.context.getBean(SampleBean.class).getName()).isEqualTo("default");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -49,6 +49,7 @@ class NonUniqueSessionRepositoryFailureAnalyzerTests {
|
|||
}
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
private final Exception createFailure(Class<? extends SessionRepository<?>>... candidates) {
|
||||
return new NonUniqueSessionRepositoryException(Arrays.asList(candidates));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ class BasicErrorControllerIntegrationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
void testErrorForMachineClientAlwaysParamsWithoutMessage() {
|
||||
load("--server.error.include-exception=true", "--server.error.include-message=always");
|
||||
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(createUrl("/noMessage"), Map.class);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -161,13 +159,13 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
|||
}
|
||||
|
||||
private void updateDependencyResolutionContext(List<Map<String, String>> bomDependencies) {
|
||||
URI[] uris = Grape.getInstance().resolve(null, bomDependencies.toArray(new Map[0]));
|
||||
URI[] uris = Grape.getInstance().resolve(null, bomDependencies.toArray(new Map<?, ?>[0]));
|
||||
DefaultModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();
|
||||
for (URI uri : uris) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -32,7 +32,6 @@ import org.springframework.boot.test.autoconfigure.core.AutoConfigureCache;
|
|||
import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters;
|
||||
import org.springframework.boot.test.autoconfigure.json.AutoConfigureJson;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
|
@ -55,9 +54,10 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
|||
* {@link WebTestClient}. For more fine-grained control of WebTestClient the
|
||||
* {@link AutoConfigureWebTestClient @AutoConfigureWebTestClient} annotation can be used.
|
||||
* <p>
|
||||
* Typically {@code @WebFluxTest} is used in combination with {@link MockBean @MockBean}
|
||||
* or {@link Import @Import} to create any collaborators required by your
|
||||
* {@code @Controller} beans.
|
||||
* Typically {@code @WebFluxTest} is used in combination with
|
||||
* {@link org.springframework.boot.test.mock.mockito.MockBean @MockBean} or
|
||||
* {@link Import @Import} to create any collaborators required by your {@code @Controller}
|
||||
* beans.
|
||||
* <p>
|
||||
* If you are looking to load your full application configuration and use WebTestClient,
|
||||
* you should consider {@link SpringBootTest @SpringBootTest} combined with
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -109,7 +109,7 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
|
|||
private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
|
||||
FilterRegistrationBeans registrations = new FilterRegistrationBeans(this.context);
|
||||
registrations.stream().map(AbstractFilterRegistrationBean.class::cast)
|
||||
.filter(AbstractFilterRegistrationBean::isEnabled)
|
||||
.filter(AbstractFilterRegistrationBean<?>::isEnabled)
|
||||
.forEach((registration) -> addFilter(builder, registration));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -31,7 +31,6 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration;
|
|||
import org.springframework.boot.test.autoconfigure.core.AutoConfigureCache;
|
||||
import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
|
@ -56,7 +55,8 @@ import org.springframework.test.web.servlet.MockMvc;
|
|||
* WebDriver). For more fine-grained control of MockMVC the
|
||||
* {@link AutoConfigureMockMvc @AutoConfigureMockMvc} annotation can be used.
|
||||
* <p>
|
||||
* Typically {@code @WebMvcTest} is used in combination with {@link MockBean @MockBean} or
|
||||
* Typically {@code @WebMvcTest} is used in combination with
|
||||
* {@link org.springframework.boot.test.mock.mockito.MockBean @MockBean} or
|
||||
* {@link Import @Import} to create any collaborators required by your {@code @Controller}
|
||||
* beans.
|
||||
* <p>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public final class WebServiceClientExcludeFilter
|
|||
|
||||
protected WebServiceClientExcludeFilter(Class<?> testClass) {
|
||||
super(testClass);
|
||||
this.components = getAnnotation().getValue("components", Class[].class).orElse(new Class[0]);
|
||||
this.components = getAnnotation().getValue("components", Class[].class).orElse(new Class<?>[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -77,6 +77,7 @@ public class FilteredClassLoader extends URLClassLoader {
|
|||
* name of a class or a resource name.
|
||||
*/
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
public FilteredClassLoader(Predicate<String>... filters) {
|
||||
this(Arrays.asList(filters), Arrays.asList(filters));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ sourceSets {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
|
||||
testImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation("javax.validation:validation-api")
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -65,3 +65,9 @@ processResources {
|
|||
dependsOn reproducibleLoaderJar
|
||||
dependsOn reproducibleJarModeLayerToolsJar
|
||||
}
|
||||
|
||||
compileJava {
|
||||
if ((!project.hasProperty("buildJavaHome")) && JavaVersion.current() == JavaVersion.VERSION_1_8) {
|
||||
options.compilerArgs += ['-Xlint:-sunapi', '-XDenableSunApiLintControl']
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -46,11 +46,10 @@ public abstract class DependencyFilter extends AbstractArtifactsFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Set filter(Set artifacts) throws ArtifactFilterException {
|
||||
Set result = new HashSet();
|
||||
for (Object artifact : artifacts) {
|
||||
if (!filter((Artifact) artifact)) {
|
||||
public Set<Artifact> filter(Set<Artifact> artifacts) throws ArtifactFilterException {
|
||||
Set<Artifact> result = new HashSet<>();
|
||||
for (Artifact artifact : artifacts) {
|
||||
if (!filter(artifact)) {
|
||||
result.add(artifact);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ public class SpringApplication {
|
|||
Banner printedBanner = printBanner(environment);
|
||||
context = createApplicationContext();
|
||||
exceptionReporters = getSpringFactoriesInstances(SpringBootExceptionReporter.class,
|
||||
new Class[] { ConfigurableApplicationContext.class }, context);
|
||||
new Class<?>[] { ConfigurableApplicationContext.class }, context);
|
||||
prepareContext(context, environment, listeners, applicationArguments, printedBanner);
|
||||
refreshContext(context);
|
||||
afterRefresh(context, applicationArguments);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -77,6 +77,7 @@ public class ServletContextInitializerBeans extends AbstractCollection<ServletCo
|
|||
private List<ServletContextInitializer> sortedList;
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
public ServletContextInitializerBeans(ListableBeanFactory beanFactory,
|
||||
Class<? extends ServletContextInitializer>... initializerTypes) {
|
||||
this.initializers = new LinkedMultiValueMap<>();
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ class ConfigurationPropertiesTests {
|
|||
AnnotationConfigApplicationContext parent = load(BasicConfiguration.class, "name=parent");
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.setParent(parent);
|
||||
load(new Class[] { BasicConfiguration.class, BasicPropertiesConsumer.class }, "name=child");
|
||||
load(new Class<?>[] { BasicConfiguration.class, BasicPropertiesConsumer.class }, "name=child");
|
||||
assertThat(this.context.getBean(BasicProperties.class)).isNotNull();
|
||||
assertThat(parent.getBean(BasicProperties.class)).isNotNull();
|
||||
assertThat(this.context.getBean(BasicPropertiesConsumer.class).getName()).isEqualTo("parent");
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -97,7 +97,7 @@ class AtomikosPropertiesTests {
|
|||
}
|
||||
|
||||
private MapEntry<?, ?>[] defaultOf(Properties defaultSettings, String... keys) {
|
||||
MapEntry<?, ?>[] entries = new MapEntry[keys.length];
|
||||
MapEntry<?, ?>[] entries = new MapEntry<?, ?>[keys.length];
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
String key = keys[i];
|
||||
entries[i] = entry(key, defaultSettings.get(key));
|
||||
|
|
|
|||
|
|
@ -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