Commit 9e084905 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch 'gh-21271'

Closes gh-21271
parents 0f1ada5e 753bea64
...@@ -25,6 +25,7 @@ import java.util.function.Consumer; ...@@ -25,6 +25,7 @@ import java.util.function.Consumer;
import io.spring.javaformat.gradle.FormatTask; import io.spring.javaformat.gradle.FormatTask;
import io.spring.javaformat.gradle.SpringJavaFormatPlugin; import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
import org.gradle.api.JavaVersion;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.ConfigurationContainer;
...@@ -56,7 +57,13 @@ import org.springframework.boot.build.testing.TestFailuresPlugin; ...@@ -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 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 * <li>{@link JavaCompile}, {@link Javadoc}, and {@link FormatTask} tasks are configured
* to use UTF-8 encoding * 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 * <li>{@link Jar} tasks are configured to produce jars with LICENSE.txt and NOTICE.txt
* files and the following manifest entries: * files and the following manifest entries:
* <ul> * <ul>
...@@ -149,6 +156,10 @@ class JavaConventions { ...@@ -149,6 +156,10 @@ class JavaConventions {
if (!args.contains("-parameters")) { if (!args.contains("-parameters")) {
args.add("-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; ...@@ -19,16 +19,12 @@ package org.springframework.boot.actuate.autoconfigure.health;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
import org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
/** /**
* Base class for configurations that can combine source beans using a * Base class for configurations that can combine source beans using a
* {@link CompositeHealthIndicator}. * {@link org.springframework.boot.actuate.health.CompositeHealthIndicator}.
* *
* @param <H> the health indicator type * @param <H> the health indicator type
* @param <S> the bean source type * @param <S> the bean source type
...@@ -40,15 +36,15 @@ import org.springframework.core.ResolvableType; ...@@ -40,15 +36,15 @@ import org.springframework.core.ResolvableType;
public abstract class CompositeHealthIndicatorConfiguration<H extends HealthIndicator, S> { public abstract class CompositeHealthIndicatorConfiguration<H extends HealthIndicator, S> {
@Autowired @Autowired
private HealthAggregator healthAggregator; private org.springframework.boot.actuate.health.HealthAggregator healthAggregator;
protected HealthIndicator createHealthIndicator(Map<String, S> beans) { protected HealthIndicator createHealthIndicator(Map<String, S> beans) {
if (beans.size() == 1) { if (beans.size() == 1) {
return createHealthIndicator(beans.values().iterator().next()); return createHealthIndicator(beans.values().iterator().next());
} }
HealthIndicatorRegistry registry = new DefaultHealthIndicatorRegistry(); org.springframework.boot.actuate.health.HealthIndicatorRegistry registry = new org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry();
beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source))); beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source)));
return new CompositeHealthIndicator(this.healthAggregator, registry); return new org.springframework.boot.actuate.health.CompositeHealthIndicator(this.healthAggregator, registry);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
......
...@@ -19,11 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.health; ...@@ -19,11 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.health;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.CompositeReactiveHealthIndicator;
import org.springframework.boot.actuate.health.DefaultReactiveHealthIndicatorRegistry;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
/** /**
...@@ -40,15 +36,16 @@ import org.springframework.core.ResolvableType; ...@@ -40,15 +36,16 @@ import org.springframework.core.ResolvableType;
public abstract class CompositeReactiveHealthIndicatorConfiguration<H extends ReactiveHealthIndicator, S> { public abstract class CompositeReactiveHealthIndicatorConfiguration<H extends ReactiveHealthIndicator, S> {
@Autowired @Autowired
private HealthAggregator healthAggregator; private org.springframework.boot.actuate.health.HealthAggregator healthAggregator;
protected ReactiveHealthIndicator createHealthIndicator(Map<String, S> beans) { protected ReactiveHealthIndicator createHealthIndicator(Map<String, S> beans) {
if (beans.size() == 1) { if (beans.size() == 1) {
return createHealthIndicator(beans.values().iterator().next()); return createHealthIndicator(beans.values().iterator().next());
} }
ReactiveHealthIndicatorRegistry registry = new DefaultReactiveHealthIndicatorRegistry(); org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry registry = new org.springframework.boot.actuate.health.DefaultReactiveHealthIndicatorRegistry();
beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source))); beans.forEach((name, source) -> registry.register(name, createHealthIndicator(source)));
return new CompositeReactiveHealthIndicator(this.healthAggregator, registry); return new org.springframework.boot.actuate.health.CompositeReactiveHealthIndicator(this.healthAggregator,
registry);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
......
...@@ -21,12 +21,12 @@ import java.util.Map; ...@@ -21,12 +21,12 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.actuate.health.StatusAggregator;
/** /**
* Adapter class to convert a legacy {@link HealthAggregator} to a * Adapter class to convert a legacy
* {@link org.springframework.boot.actuate.health.HealthAggregator} to a
* {@link StatusAggregator}. * {@link StatusAggregator}.
* *
* @author Phillip Webb * @author Phillip Webb
...@@ -34,9 +34,9 @@ import org.springframework.boot.actuate.health.StatusAggregator; ...@@ -34,9 +34,9 @@ import org.springframework.boot.actuate.health.StatusAggregator;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class HealthAggregatorStatusAggregatorAdapter implements StatusAggregator { class HealthAggregatorStatusAggregatorAdapter implements StatusAggregator {
private HealthAggregator healthAggregator; private org.springframework.boot.actuate.health.HealthAggregator healthAggregator;
HealthAggregatorStatusAggregatorAdapter(HealthAggregator healthAggregator) { HealthAggregatorStatusAggregatorAdapter(org.springframework.boot.actuate.health.HealthAggregator healthAggregator) {
this.healthAggregator = healthAggregator; this.healthAggregator = healthAggregator;
} }
......
...@@ -22,18 +22,18 @@ import java.util.Map; ...@@ -22,18 +22,18 @@ import java.util.Map;
import org.springframework.boot.actuate.health.HealthContributor; import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.boot.actuate.health.NamedContributor; import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Adapter class to convert a {@link HealthContributorRegistry} to a legacy * Adapter class to convert a {@link HealthContributorRegistry} to a legacy
* {@link HealthIndicatorRegistry}. * {@link org.springframework.boot.actuate.health.HealthIndicatorRegistry}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class HealthContributorRegistryHealthIndicatorRegistryAdapter implements HealthIndicatorRegistry { class HealthContributorRegistryHealthIndicatorRegistryAdapter
implements org.springframework.boot.actuate.health.HealthIndicatorRegistry {
private final HealthContributorRegistry contributorRegistry; private final HealthContributorRegistry contributorRegistry;
......
...@@ -18,12 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.health; ...@@ -18,12 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.health;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -40,13 +36,14 @@ import org.springframework.util.CollectionUtils; ...@@ -40,13 +36,14 @@ import org.springframework.util.CollectionUtils;
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EnableConfigurationProperties(HealthIndicatorProperties.class) @EnableConfigurationProperties(org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties.class)
class LegacyHealthEndpointCompatibilityConfiguration { class LegacyHealthEndpointCompatibilityConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
HealthAggregator healthAggregator(HealthIndicatorProperties healthIndicatorProperties) { org.springframework.boot.actuate.health.HealthAggregator healthAggregator(
OrderedHealthAggregator aggregator = new OrderedHealthAggregator(); HealthIndicatorProperties healthIndicatorProperties) {
org.springframework.boot.actuate.health.OrderedHealthAggregator aggregator = new org.springframework.boot.actuate.health.OrderedHealthAggregator();
if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) { if (!CollectionUtils.isEmpty(healthIndicatorProperties.getOrder())) {
aggregator.setStatusOrder(healthIndicatorProperties.getOrder()); aggregator.setStatusOrder(healthIndicatorProperties.getOrder());
} }
...@@ -54,7 +51,7 @@ class LegacyHealthEndpointCompatibilityConfiguration { ...@@ -54,7 +51,7 @@ class LegacyHealthEndpointCompatibilityConfiguration {
} }
@Bean @Bean
@ConditionalOnMissingBean(HealthIndicatorRegistry.class) @ConditionalOnMissingBean(org.springframework.boot.actuate.health.HealthIndicatorRegistry.class)
HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry( HealthContributorRegistryHealthIndicatorRegistryAdapter healthIndicatorRegistry(
HealthContributorRegistry healthContributorRegistry) { HealthContributorRegistry healthContributorRegistry) {
return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry); return new HealthContributorRegistryHealthIndicatorRegistryAdapter(healthContributorRegistry);
...@@ -65,7 +62,7 @@ class LegacyHealthEndpointCompatibilityConfiguration { ...@@ -65,7 +62,7 @@ class LegacyHealthEndpointCompatibilityConfiguration {
static class LegacyReactiveHealthEndpointCompatibilityConfiguration { static class LegacyReactiveHealthEndpointCompatibilityConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(ReactiveHealthIndicatorRegistry.class) @ConditionalOnMissingBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class)
ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry( ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter reactiveHealthIndicatorRegistry(
ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) { ReactiveHealthContributorRegistry reactiveHealthContributorRegistry) {
return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter( return new ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter(
......
...@@ -23,18 +23,17 @@ import org.springframework.boot.actuate.health.NamedContributor; ...@@ -23,18 +23,17 @@ import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributor; import org.springframework.boot.actuate.health.ReactiveHealthContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Adapter class to convert a {@link ReactiveHealthContributorRegistry} to a legacy * Adapter class to convert a {@link ReactiveHealthContributorRegistry} to a legacy
* {@link ReactiveHealthIndicatorRegistry}. * {@link org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter class ReactiveHealthContributorRegistryReactiveHealthIndicatorRegistryAdapter
implements ReactiveHealthIndicatorRegistry { implements org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry {
private final ReactiveHealthContributorRegistry contributorRegistry; private final ReactiveHealthContributorRegistry contributorRegistry;
......
...@@ -57,6 +57,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp ...@@ -57,6 +57,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
} }
@Override @Override
@Deprecated
public TimeUnit rateUnits() { public TimeUnit rateUnits() {
return get(GangliaProperties::getRateUnits, GangliaConfig.super::rateUnits); return get(GangliaProperties::getRateUnits, GangliaConfig.super::rateUnits);
} }
...@@ -67,6 +68,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp ...@@ -67,6 +68,7 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
} }
@Override @Override
@Deprecated
public String protocolVersion() { public String protocolVersion() {
return get(GangliaProperties::getProtocolVersion, GangliaConfig.super::protocolVersion); return get(GangliaProperties::getProtocolVersion, GangliaConfig.super::protocolVersion);
} }
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -49,6 +49,7 @@ public abstract class ManagementWebServerFactoryCustomizer<T extends Configurabl ...@@ -49,6 +49,7 @@ public abstract class ManagementWebServerFactoryCustomizer<T extends Configurabl
private final Class<? extends WebServerFactoryCustomizer<?>>[] customizerClasses; private final Class<? extends WebServerFactoryCustomizer<?>>[] customizerClasses;
@SafeVarargs @SafeVarargs
@SuppressWarnings("varargs")
protected ManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory, protected ManagementWebServerFactoryCustomizer(ListableBeanFactory beanFactory,
Class<? extends WebServerFactoryCustomizer<?>>... customizerClasses) { Class<? extends WebServerFactoryCustomizer<?>>... customizerClasses) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
......
...@@ -38,7 +38,6 @@ import org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoCo ...@@ -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.info.InfoEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.endpoint.EndpointId; 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.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType; import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType;
...@@ -208,7 +207,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests { ...@@ -208,7 +207,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
.run((context) -> { .run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(context); CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(context);
Collection<ExposableWebEndpoint> endpoints = handlerMapping.getEndpoints(); Collection<ExposableWebEndpoint> endpoints = handlerMapping.getEndpoints();
List<EndpointId> endpointIds = endpoints.stream().map(ExposableEndpoint::getEndpointId) List<EndpointId> endpointIds = endpoints.stream().map(ExposableWebEndpoint::getEndpointId)
.collect(Collectors.toList()); .collect(Collectors.toList());
assertThat(endpointIds).contains(EndpointId.of("test")); assertThat(endpointIds).contains(EndpointId.of("test"));
}); });
......
...@@ -20,7 +20,6 @@ import java.util.List; ...@@ -20,7 +20,6 @@ import java.util.List;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.health.AbstractHealthAggregator;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.actuate.health.StatusAggregator;
...@@ -41,7 +40,7 @@ class HealthAggregatorStatusAggregatorAdapterTests { ...@@ -41,7 +40,7 @@ class HealthAggregatorStatusAggregatorAdapterTests {
assertThat(status.getCode()).isEqualTo("called2"); assertThat(status.getCode()).isEqualTo("called2");
} }
private static class TestHealthAggregator extends AbstractHealthAggregator { private static class TestHealthAggregator extends org.springframework.boot.actuate.health.AbstractHealthAggregator {
@Override @Override
protected Status aggregateStatus(List<Status> candidates) { protected Status aggregateStatus(List<Status> candidates) {
......
...@@ -28,11 +28,9 @@ import reactor.core.publisher.Mono; ...@@ -28,11 +28,9 @@ import reactor.core.publisher.Mono;
import org.springframework.boot.actuate.endpoint.SecurityContext; import org.springframework.boot.actuate.endpoint.SecurityContext;
import org.springframework.boot.actuate.endpoint.http.ApiVersion; import org.springframework.boot.actuate.endpoint.http.ApiVersion;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.health.AbstractHealthAggregator;
import org.springframework.boot.actuate.health.DefaultHealthContributorRegistry; import org.springframework.boot.actuate.health.DefaultHealthContributorRegistry;
import org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.DefaultReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthComponent; import org.springframework.boot.actuate.health.HealthComponent;
import org.springframework.boot.actuate.health.HealthContributorRegistry; import org.springframework.boot.actuate.health.HealthContributorRegistry;
import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpoint;
...@@ -45,7 +43,6 @@ import org.springframework.boot.actuate.health.NamedContributor; ...@@ -45,7 +43,6 @@ import org.springframework.boot.actuate.health.NamedContributor;
import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry; import org.springframework.boot.actuate.health.ReactiveHealthContributorRegistry;
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension; import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
import org.springframework.boot.actuate.health.ReactiveHealthIndicator; import org.springframework.boot.actuate.health.ReactiveHealthIndicator;
import org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.actuate.health.StatusAggregator; import org.springframework.boot.actuate.health.StatusAggregator;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
...@@ -283,7 +280,8 @@ class HealthEndpointAutoConfigurationTests { ...@@ -283,7 +280,8 @@ class HealthEndpointAutoConfigurationTests {
@Test // gh-18354 @Test // gh-18354
void runCreatesLegacyHealthAggregator() { void runCreatesLegacyHealthAggregator() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
HealthAggregator aggregator = context.getBean(HealthAggregator.class); org.springframework.boot.actuate.health.HealthAggregator aggregator = context
.getBean(org.springframework.boot.actuate.health.HealthAggregator.class);
Map<String, Health> healths = new LinkedHashMap<>(); Map<String, Health> healths = new LinkedHashMap<>();
healths.put("one", Health.up().build()); healths.put("one", Health.up().build());
healths.put("two", Health.down().build()); healths.put("two", Health.down().build());
...@@ -294,13 +292,15 @@ class HealthEndpointAutoConfigurationTests { ...@@ -294,13 +292,15 @@ class HealthEndpointAutoConfigurationTests {
@Test @Test
void runWhenReactorAvailableCreatesReactiveHealthIndicatorRegistryBean() { void runWhenReactorAvailableCreatesReactiveHealthIndicatorRegistryBean() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ReactiveHealthIndicatorRegistry.class)); this.contextRunner.run((context) -> assertThat(context)
.hasSingleBean(org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class));
} }
@Test // gh-18570 @Test // gh-18570
void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() { void runWhenReactorUnavailableDoesNotCreateReactiveHealthIndicatorRegistryBean() {
this.contextRunner.withClassLoader(new FilteredClassLoader(Mono.class.getPackage().getName())) this.contextRunner.withClassLoader(new FilteredClassLoader(Mono.class.getPackage().getName()))
.run((context) -> assertThat(context).doesNotHaveBean(ReactiveHealthIndicatorRegistry.class)); .run((context) -> assertThat(context).doesNotHaveBean(
org.springframework.boot.actuate.health.ReactiveHealthIndicatorRegistry.class));
} }
@Test @Test
...@@ -337,8 +337,8 @@ class HealthEndpointAutoConfigurationTests { ...@@ -337,8 +337,8 @@ class HealthEndpointAutoConfigurationTests {
static class HealthAggregatorConfiguration { static class HealthAggregatorConfiguration {
@Bean @Bean
HealthAggregator healthAggregator() { org.springframework.boot.actuate.health.HealthAggregator healthAggregator() {
return new AbstractHealthAggregator() { return new org.springframework.boot.actuate.health.AbstractHealthAggregator() {
@Override @Override
protected Status aggregateStatus(List<Status> candidates) { protected Status aggregateStatus(List<Status> candidates) {
......
...@@ -23,9 +23,6 @@ import org.junit.jupiter.api.Test; ...@@ -23,9 +23,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.boot.actuate.health.Status; import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
...@@ -35,7 +32,8 @@ import org.springframework.context.annotation.Configuration; ...@@ -35,7 +32,8 @@ import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration test to ensure that the legacy {@link HealthIndicatorRegistry} can still be * Integration test to ensure that the legacy
* {@link org.springframework.boot.actuate.health.HealthIndicatorRegistry} can still be
* injected. * injected.
* *
* @author Phillip Webb * @author Phillip Webb
...@@ -57,16 +55,17 @@ public class HealthIndicatorRegistryInjectionIntegrationTests { ...@@ -57,16 +55,17 @@ public class HealthIndicatorRegistryInjectionIntegrationTests {
CompositeMeterRegistryAutoConfiguration.class, MetricsAutoConfiguration.class }) CompositeMeterRegistryAutoConfiguration.class, MetricsAutoConfiguration.class })
static class Config { static class Config {
Config(HealthAggregator healthAggregator, HealthIndicatorRegistry healthIndicatorRegistry, Config(org.springframework.boot.actuate.health.HealthAggregator healthAggregator,
org.springframework.boot.actuate.health.HealthIndicatorRegistry healthIndicatorRegistry,
MeterRegistry registry) { MeterRegistry registry) {
CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(healthAggregator, org.springframework.boot.actuate.health.CompositeHealthIndicator healthIndicator = new org.springframework.boot.actuate.health.CompositeHealthIndicator(
healthIndicatorRegistry); healthAggregator, healthIndicatorRegistry);
Gauge.builder("health", healthIndicator, this::getGaugeValue) Gauge.builder("health", healthIndicator, this::getGaugeValue)
.description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN") .description("Spring boot health indicator. 3=UP, 2=OUT_OF_SERVICE, 1=DOWN, 0=UNKNOWN")
.strongReference(true).register(registry); .strongReference(true).register(registry);
} }
private double getGaugeValue(CompositeHealthIndicator health) { private double getGaugeValue(org.springframework.boot.actuate.health.CompositeHealthIndicator health) {
Status status = health.health().getStatus(); Status status = health.health().getStatus();
switch (status.getCode()) { switch (status.getCode()) {
case "UP": case "UP":
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -47,12 +47,12 @@ class JerseyEndpointIntegrationTests { ...@@ -47,12 +47,12 @@ class JerseyEndpointIntegrationTests {
@Test @Test
void linksAreProvidedToAllEndpointTypes() { void linksAreProvidedToAllEndpointTypes() {
testJerseyEndpoints(new Class[] { EndpointsConfiguration.class, ResourceConfigConfiguration.class }); testJerseyEndpoints(new Class<?>[] { EndpointsConfiguration.class, ResourceConfigConfiguration.class });
} }
@Test @Test
void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() { void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() {
testJerseyEndpoints(new Class[] { EndpointsConfiguration.class }); testJerseyEndpoints(new Class<?>[] { EndpointsConfiguration.class });
} }
protected void testJerseyEndpoints(Class<?>[] userConfigurations) { protected void testJerseyEndpoints(Class<?>[] userConfigurations) {
......
...@@ -23,6 +23,7 @@ import org.junit.jupiter.api.BeforeEach; ...@@ -23,6 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.web.ErrorProperties; import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
...@@ -111,7 +112,7 @@ class ManagementErrorEndpointTests { ...@@ -111,7 +112,7 @@ class ManagementErrorEndpointTests {
ErrorAttributes attributes = new ErrorAttributes() { ErrorAttributes attributes = new ErrorAttributes() {
@Override @Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
return Collections.singletonMap("message", "An error occurred"); return Collections.singletonMap("message", "An error occurred");
} }
...@@ -154,7 +155,7 @@ class ManagementErrorEndpointTests { ...@@ -154,7 +155,7 @@ class ManagementErrorEndpointTests {
ErrorAttributes attributes = new DefaultErrorAttributes() { ErrorAttributes attributes = new DefaultErrorAttributes() {
@Override @Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
return Collections.singletonMap("error", "custom error"); return Collections.singletonMap("error", "custom error");
} }
......
...@@ -158,6 +158,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin ...@@ -158,6 +158,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
return new RequestMatchResult(patterns.iterator().next(), lookupPath, getPathMatcher()); return new RequestMatchResult(patterns.iterator().next(), lookupPath, getPathMatcher());
} }
@SuppressWarnings("deprecation")
private static RequestMappingInfo.BuilderConfiguration getBuilderConfig() { private static RequestMappingInfo.BuilderConfiguration getBuilderConfig() {
RequestMappingInfo.BuilderConfiguration config = new RequestMappingInfo.BuilderConfiguration(); RequestMappingInfo.BuilderConfiguration config = new RequestMappingInfo.BuilderConfiguration();
config.setUrlPathHelper(null); config.setUrlPathHelper(null);
...@@ -215,6 +216,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin ...@@ -215,6 +216,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
HttpServletRequest.class, HttpServletResponse.class)); HttpServletRequest.class, HttpServletResponse.class));
} }
@SuppressWarnings("deprecation")
private PatternsRequestCondition patternsRequestConditionForPattern(String path) { private PatternsRequestCondition patternsRequestConditionForPattern(String path) {
String[] patterns = new String[] { this.endpointMapping.createSubPath(path) }; String[] patterns = new String[] { this.endpointMapping.createSubPath(path) };
return new PatternsRequestCondition(patterns, builderConfig.getUrlPathHelper(), builderConfig.getPathMatcher(), return new PatternsRequestCondition(patterns, builderConfig.getUrlPathHelper(), builderConfig.getPathMatcher(),
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -58,6 +58,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi ...@@ -58,6 +58,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
* @param endpoints the web endpoints * @param endpoints the web endpoints
* @param corsConfiguration the CORS configuration for the endpoints or {@code null} * @param corsConfiguration the CORS configuration for the endpoints or {@code null}
*/ */
@SuppressWarnings("deprecation")
public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping, public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping,
Collection<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) { Collection<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) {
Assert.notNull(endpointMapping, "EndpointMapping must not be null"); Assert.notNull(endpointMapping, "EndpointMapping must not be null");
...@@ -102,6 +103,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi ...@@ -102,6 +103,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern); return this.endpointMapping.createSubPath(endpoint.getRootPath() + pattern);
} }
@SuppressWarnings("deprecation")
private RequestMappingInfo withNewPatterns(RequestMappingInfo mapping, String[] patterns) { private RequestMappingInfo withNewPatterns(RequestMappingInfo mapping, String[] patterns) {
PatternsRequestCondition patternsCondition = new PatternsRequestCondition(patterns, null, null, PatternsRequestCondition patternsCondition = new PatternsRequestCondition(patterns, null, null,
useSuffixPatternMatch(), useTrailingSlashMatch(), null); useSuffixPatternMatch(), useTrailingSlashMatch(), null);
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,18 +19,20 @@ package org.springframework.boot.actuate.endpoint.web.servlet; ...@@ -19,18 +19,20 @@ package org.springframework.boot.actuate.endpoint.web.servlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/** /**
* {@link HandlerInterceptorAdapter} to ensure that * {@link HandlerInterceptorAdapter} to ensure that
* {@link PathExtensionContentNegotiationStrategy} is skipped for web endpoints. * {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy} is
* skipped for web endpoints.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
final class SkipPathExtensionContentNegotiation extends HandlerInterceptorAdapter { final class SkipPathExtensionContentNegotiation extends HandlerInterceptorAdapter {
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP"; @SuppressWarnings("deprecation")
private static final String SKIP_ATTRIBUTE = org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,7 +25,6 @@ import java.util.stream.Collectors; ...@@ -25,7 +25,6 @@ import java.util.stream.Collectors;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.endpoint.EndpointId; 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.DiscoveredEndpoint;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
...@@ -114,7 +113,7 @@ class ControllerEndpointDiscovererTests { ...@@ -114,7 +113,7 @@ class ControllerEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class) this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
List<EndpointId> ids = endpoints.stream().map(ExposableEndpoint::getEndpointId) List<EndpointId> ids = endpoints.stream().map(ExposableControllerEndpoint::getEndpointId)
.collect(Collectors.toList()); .collect(Collectors.toList());
assertThat(ids).containsOnly(EndpointId.of("testcontroller"), EndpointId.of("testrestcontroller")); assertThat(ids).containsOnly(EndpointId.of("testcontroller"), EndpointId.of("testrestcontroller"));
})); }));
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,7 +32,6 @@ import javax.servlet.ServletResponse; ...@@ -32,7 +32,6 @@ import javax.servlet.ServletResponse;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.endpoint.EndpointId; 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.DiscoveredEndpoint;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
...@@ -97,7 +96,7 @@ class ServletEndpointDiscovererTests { ...@@ -97,7 +96,7 @@ class ServletEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class) this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
List<EndpointId> ids = endpoints.stream().map(ExposableEndpoint::getEndpointId) List<EndpointId> ids = endpoints.stream().map(ExposableServletEndpoint::getEndpointId)
.collect(Collectors.toList()); .collect(Collectors.toList());
assertThat(ids).containsOnly(EndpointId.of("testservlet")); assertThat(ids).containsOnly(EndpointId.of("testservlet"));
})); }));
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -89,9 +89,10 @@ class HttpTraceWebFilterTests { ...@@ -89,9 +89,10 @@ class HttpTraceWebFilterTests {
executeFilter(new ServerWebExchangeDecorator( executeFilter(new ServerWebExchangeDecorator(
MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com"))) { MockServerWebExchange.from(MockServerHttpRequest.get("https://api.example.com"))) {
@SuppressWarnings("unchecked")
@Override @Override
public Mono<Principal> getPrincipal() { public <T extends Principal> Mono<T> getPrincipal() {
return Mono.just(principal); return Mono.just((T) principal);
} }
}, (exchange) -> { }, (exchange) -> {
......
...@@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; ...@@ -22,7 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration; import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories; import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
...@@ -38,7 +38,7 @@ import org.springframework.data.elasticsearch.repository.config.EnableReactiveEl ...@@ -38,7 +38,7 @@ import org.springframework.data.elasticsearch.repository.config.EnableReactiveEl
* @since 1.1.0 * @since 1.1.0
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ElasticsearchTemplate.class }) @ConditionalOnClass({ ElasticsearchRestTemplate.class })
@AutoConfigureAfter({ ElasticsearchRestClientAutoConfiguration.class, @AutoConfigureAfter({ ElasticsearchRestClientAutoConfiguration.class,
ReactiveElasticsearchRestClientAutoConfiguration.class }) ReactiveElasticsearchRestClientAutoConfiguration.class })
@Import({ ElasticsearchDataConfiguration.BaseConfiguration.class, @Import({ ElasticsearchDataConfiguration.BaseConfiguration.class,
......
...@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.integration; ...@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.integration;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import javax.sql.DataSource; import javax.sql.DataSource;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
...@@ -156,8 +155,9 @@ public class IntegrationAutoConfiguration { ...@@ -156,8 +155,9 @@ public class IntegrationAutoConfiguration {
/** /**
* Integration RSocket configuration. * Integration RSocket configuration.
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, RSocketFactory.class }) @ConditionalOnClass({ IntegrationRSocketEndpoint.class, RSocketRequester.class, io.rsocket.RSocketFactory.class })
@Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class) @Conditional(IntegrationRSocketConfiguration.AnyRSocketChannelAdapterAvailable.class)
protected static class IntegrationRSocketConfiguration { protected static class IntegrationRSocketConfiguration {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -18,12 +18,12 @@ package org.springframework.boot.autoconfigure.jms.artemis; ...@@ -18,12 +18,12 @@ package org.springframework.boot.autoconfigure.jms.artemis;
import java.io.File; import java.io.File;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.JournalType;
...@@ -77,7 +77,7 @@ class ArtemisEmbeddedConfigurationFactory { ...@@ -77,7 +77,7 @@ class ArtemisEmbeddedConfigurationFactory {
private CoreAddressConfiguration createAddressConfiguration(String name) { private CoreAddressConfiguration createAddressConfiguration(String name) {
return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration( return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(
new CoreQueueConfiguration().setName(name).setRoutingType(RoutingType.ANYCAST).setAddress(name)); new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).setAddress(name));
} }
private String getDataDir() { private String getDataDir() {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.jms.artemis; ...@@ -19,9 +19,9 @@ package org.springframework.boot.autoconfigure.jms.artemis;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; import org.apache.activemq.artemis.jms.server.config.JMSConfiguration;
import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration; import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration;
...@@ -71,7 +71,7 @@ class ArtemisEmbeddedServerConfiguration { ...@@ -71,7 +71,7 @@ class ArtemisEmbeddedServerConfiguration {
String queueName = queueConfiguration.getName(); String queueName = queueConfiguration.getName();
configuration.addAddressConfiguration( configuration.addAddressConfiguration(
new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST) new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST)
.addQueueConfiguration(new CoreQueueConfiguration().setAddress(queueName).setName(queueName) .addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName)
.setFilterString(queueConfiguration.getSelector()) .setFilterString(queueConfiguration.getSelector())
.setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST))); .setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST)));
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.rsocket; package org.springframework.boot.autoconfigure.rsocket;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
...@@ -37,8 +36,9 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa ...@@ -37,8 +36,9 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, TcpServerTransport.class }) @ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, TcpServerTransport.class })
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
public class RSocketMessagingAutoConfiguration { public class RSocketMessagingAutoConfiguration {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.rsocket; package org.springframework.boot.autoconfigure.rsocket;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport; import io.rsocket.transport.netty.server.TcpServerTransport;
import reactor.netty.http.server.HttpServer; import reactor.netty.http.server.HttpServer;
...@@ -40,8 +39,10 @@ import org.springframework.messaging.rsocket.RSocketStrategies; ...@@ -40,8 +39,10 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, HttpServer.class, TcpServerTransport.class }) @ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, HttpServer.class,
TcpServerTransport.class })
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class) @AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
public class RSocketRequesterAutoConfiguration { public class RSocketRequesterAutoConfiguration {
......
...@@ -38,7 +38,6 @@ import org.springframework.boot.rsocket.context.RSocketServerBootstrap; ...@@ -38,7 +38,6 @@ import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory; import org.springframework.boot.rsocket.netty.NettyRSocketServerFactory;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.RSocketServerFactory; import org.springframework.boot.rsocket.server.RSocketServerFactory;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -72,7 +71,8 @@ public class RSocketServerAutoConfiguration { ...@@ -72,7 +71,8 @@ public class RSocketServerAutoConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties, RSocketWebSocketNettyRouteProvider rSocketWebsocketRouteProvider(RSocketProperties properties,
RSocketMessageHandler messageHandler, ObjectProvider<ServerRSocketFactoryProcessor> processors, RSocketMessageHandler messageHandler,
ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
ObjectProvider<RSocketServerCustomizer> customizers) { ObjectProvider<RSocketServerCustomizer> customizers) {
return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(), return new RSocketWebSocketNettyRouteProvider(properties.getServer().getMappingPath(),
messageHandler.responder(), processors.orderedStream(), customizers.orderedStream()); messageHandler.responder(), processors.orderedStream(), customizers.orderedStream());
...@@ -94,7 +94,7 @@ public class RSocketServerAutoConfiguration { ...@@ -94,7 +94,7 @@ public class RSocketServerAutoConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory, RSocketServerFactory rSocketServerFactory(RSocketProperties properties, ReactorResourceFactory resourceFactory,
ObjectProvider<ServerRSocketFactoryProcessor> processors, ObjectProvider<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
ObjectProvider<RSocketServerCustomizer> customizers) { ObjectProvider<RSocketServerCustomizer> customizers) {
NettyRSocketServerFactory factory = new NettyRSocketServerFactory(); NettyRSocketServerFactory factory = new NettyRSocketServerFactory();
factory.setResourceFactory(resourceFactory); factory.setResourceFactory(resourceFactory);
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket; ...@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory; import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import io.netty.buffer.PooledByteBufAllocator; import io.netty.buffer.PooledByteBufAllocator;
import io.rsocket.RSocketFactory;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
...@@ -48,8 +47,9 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher; ...@@ -48,8 +47,9 @@ import org.springframework.web.util.pattern.PathPatternRouteMatcher;
* @author Brian Clozel * @author Brian Clozel
* @since 2.2.0 * @since 2.2.0
*/ */
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class }) @ConditionalOnClass({ io.rsocket.RSocketFactory.class, RSocketStrategies.class, PooledByteBufAllocator.class })
@AutoConfigureAfter(JacksonAutoConfiguration.class) @AutoConfigureAfter(JacksonAutoConfiguration.class)
public class RSocketStrategiesAutoConfiguration { public class RSocketStrategiesAutoConfiguration {
......
...@@ -20,7 +20,6 @@ import java.util.List; ...@@ -20,7 +20,6 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import io.rsocket.RSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.core.RSocketServer; import io.rsocket.core.RSocketServer;
import io.rsocket.transport.ServerTransport; import io.rsocket.transport.ServerTransport;
...@@ -28,7 +27,6 @@ import io.rsocket.transport.netty.server.WebsocketRouteTransport; ...@@ -28,7 +27,6 @@ import io.rsocket.transport.netty.server.WebsocketRouteTransport;
import reactor.netty.http.server.HttpServerRoutes; import reactor.netty.http.server.HttpServerRoutes;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.boot.web.embedded.netty.NettyRouteProvider; import org.springframework.boot.web.embedded.netty.NettyRouteProvider;
/** /**
...@@ -43,12 +41,13 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider { ...@@ -43,12 +41,13 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
private final SocketAcceptor socketAcceptor; private final SocketAcceptor socketAcceptor;
private final List<ServerRSocketFactoryProcessor> processors; private final List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors;
private final List<RSocketServerCustomizer> customizers; private final List<RSocketServerCustomizer> customizers;
RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor, RSocketWebSocketNettyRouteProvider(String mappingPath, SocketAcceptor socketAcceptor,
Stream<ServerRSocketFactoryProcessor> processors, Stream<RSocketServerCustomizer> customizers) { Stream<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> processors,
Stream<RSocketServerCustomizer> customizers) {
this.mappingPath = mappingPath; this.mappingPath = mappingPath;
this.socketAcceptor = socketAcceptor; this.socketAcceptor = socketAcceptor;
this.processors = processors.collect(Collectors.toList()); this.processors = processors.collect(Collectors.toList());
...@@ -58,7 +57,8 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider { ...@@ -58,7 +57,8 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
@Override @Override
public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) { public HttpServerRoutes apply(HttpServerRoutes httpServerRoutes) {
RSocketServer server = RSocketServer.create(this.socketAcceptor); RSocketServer server = RSocketServer.create(this.socketAcceptor);
RSocketFactory.ServerRSocketFactory factory = new RSocketFactory.ServerRSocketFactory(server); io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory(
server);
this.processors.forEach((processor) -> processor.process(factory)); this.processors.forEach((processor) -> processor.process(factory));
this.customizers.forEach((customizer) -> customizer.customize(server)); this.customizers.forEach((customizer) -> customizer.customize(server));
ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor(); ServerTransport.ConnectionAcceptor connectionAcceptor = server.asConnectionAcceptor();
......
...@@ -34,9 +34,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -34,9 +34,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jdbc.XADataSourceWrapper; import org.springframework.boot.jdbc.XADataSourceWrapper;
import org.springframework.boot.jms.XAConnectionFactoryWrapper; import org.springframework.boot.jms.XAConnectionFactoryWrapper;
import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor;
import org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper;
import org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper;
import org.springframework.boot.system.ApplicationHome; import org.springframework.boot.system.ApplicationHome;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -92,14 +89,14 @@ class BitronixJtaConfiguration { ...@@ -92,14 +89,14 @@ class BitronixJtaConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class) @ConditionalOnMissingBean(XADataSourceWrapper.class)
BitronixXADataSourceWrapper xaDataSourceWrapper() { org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper xaDataSourceWrapper() {
return new BitronixXADataSourceWrapper(); return new org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper();
} }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
static BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() { static org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor bitronixDependentBeanFactoryPostProcessor() {
return new BitronixDependentBeanFactoryPostProcessor(); return new org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor();
} }
@Bean @Bean
...@@ -116,8 +113,8 @@ class BitronixJtaConfiguration { ...@@ -116,8 +113,8 @@ class BitronixJtaConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(XAConnectionFactoryWrapper.class) @ConditionalOnMissingBean(XAConnectionFactoryWrapper.class)
BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() { org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
return new BitronixXAConnectionFactoryWrapper(); return new org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper();
} }
} }
......
...@@ -82,7 +82,6 @@ import org.springframework.validation.Validator; ...@@ -82,7 +82,6 @@ import org.springframework.validation.Validator;
import org.springframework.web.HttpMediaTypeNotAcceptableException; import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ContentNegotiationStrategy;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
...@@ -499,13 +498,14 @@ public class WebMvcAutoConfiguration { ...@@ -499,13 +498,14 @@ public class WebMvcAutoConfiguration {
@Bean @Bean
@Override @Override
@SuppressWarnings("deprecation")
public ContentNegotiationManager mvcContentNegotiationManager() { public ContentNegotiationManager mvcContentNegotiationManager() {
ContentNegotiationManager manager = super.mvcContentNegotiationManager(); ContentNegotiationManager manager = super.mvcContentNegotiationManager();
List<ContentNegotiationStrategy> strategies = manager.getStrategies(); List<ContentNegotiationStrategy> strategies = manager.getStrategies();
ListIterator<ContentNegotiationStrategy> iterator = strategies.listIterator(); ListIterator<ContentNegotiationStrategy> iterator = strategies.listIterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ContentNegotiationStrategy strategy = iterator.next(); ContentNegotiationStrategy strategy = iterator.next();
if (strategy instanceof PathExtensionContentNegotiationStrategy) { if (strategy instanceof org.springframework.web.accept.PathExtensionContentNegotiationStrategy) {
iterator.set(new OptionalPathExtensionContentNegotiationStrategy(strategy)); iterator.set(new OptionalPathExtensionContentNegotiationStrategy(strategy));
} }
} }
...@@ -577,12 +577,15 @@ public class WebMvcAutoConfiguration { ...@@ -577,12 +577,15 @@ public class WebMvcAutoConfiguration {
} }
/** /**
* Decorator to make {@link PathExtensionContentNegotiationStrategy} optional * Decorator to make
* depending on a request attribute. * {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy}
* optional depending on a request attribute.
*/ */
static class OptionalPathExtensionContentNegotiationStrategy implements ContentNegotiationStrategy { static class OptionalPathExtensionContentNegotiationStrategy implements ContentNegotiationStrategy {
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP"; @SuppressWarnings("deprecation")
private static final String SKIP_ATTRIBUTE = org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
private final ContentNegotiationStrategy delegate; private final ContentNegotiationStrategy delegate;
......
...@@ -82,6 +82,7 @@ public class BasicErrorController extends AbstractErrorController { ...@@ -82,6 +82,7 @@ public class BasicErrorController extends AbstractErrorController {
} }
@Override @Override
@Deprecated
public String getErrorPath() { public String getErrorPath() {
return null; return null;
} }
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -43,7 +43,7 @@ public class JettyWebSocketServletWebServerCustomizer ...@@ -43,7 +43,7 @@ public class JettyWebSocketServletWebServerCustomizer
@Override @Override
public void configure(WebAppContext context) throws Exception { public void configure(WebAppContext context) throws Exception {
ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(context); ServerContainer serverContainer = WebSocketServerContainerInitializer.initialize(context);
ShutdownThread.deregister(serverContainer); ShutdownThread.deregister(serverContainer);
} }
......
...@@ -42,6 +42,7 @@ import org.springframework.beans.factory.BeanCreationException; ...@@ -42,6 +42,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider; 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.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
...@@ -354,8 +355,9 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests { ...@@ -354,8 +355,9 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
assertThat(cacheManager.getCacheNames()).containsOnly("one", "two"); assertThat(cacheManager.getCacheNames()).containsOnly("one", "two");
CompleteConfiguration<?, ?> defaultCacheConfiguration = context CompleteConfiguration<?, ?> defaultCacheConfiguration = context
.getBean(CompleteConfiguration.class); .getBean(CompleteConfiguration.class);
verify(cacheManager.getCacheManager()).createCache("one", defaultCacheConfiguration); MockCacheManager mockCacheManager = (MockCacheManager) cacheManager.getCacheManager();
verify(cacheManager.getCacheManager()).createCache("two", defaultCacheConfiguration); assertThat(mockCacheManager.getConfigurations()).containsEntry("one", defaultCacheConfiguration)
.containsEntry("two", defaultCacheConfiguration);
}); });
} }
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,8 +27,6 @@ import javax.cache.configuration.Configuration; ...@@ -27,8 +27,6 @@ import javax.cache.configuration.Configuration;
import javax.cache.configuration.OptionalFeature; import javax.cache.configuration.OptionalFeature;
import javax.cache.spi.CachingProvider; 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.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -41,25 +39,8 @@ import static org.mockito.Mockito.mock; ...@@ -41,25 +39,8 @@ import static org.mockito.Mockito.mock;
public class MockCachingProvider implements CachingProvider { public class MockCachingProvider implements CachingProvider {
@Override @Override
@SuppressWarnings("rawtypes")
public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) { public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
CacheManager cacheManager = mock(CacheManager.class); return new MockCacheManager(uri, classLoader, properties);
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;
} }
@Override @Override
...@@ -104,4 +85,108 @@ public class MockCachingProvider implements CachingProvider { ...@@ -104,4 +85,108 @@ public class MockCachingProvider implements CachingProvider {
return false; 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;
}
}
} }
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -46,13 +46,13 @@ class ConfigurationPropertiesAutoConfigurationTests { ...@@ -46,13 +46,13 @@ class ConfigurationPropertiesAutoConfigurationTests {
@Test @Test
void processAnnotatedBean() { 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"); assertThat(this.context.getBean(SampleBean.class).getName()).isEqualTo("test");
} }
@Test @Test
void processAnnotatedBeanNoAutoConfig() { 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"); assertThat(this.context.getBean(SampleBean.class).getName()).isEqualTo("default");
} }
......
...@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; ...@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext; import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext;
...@@ -109,7 +108,8 @@ class RSocketWebSocketNettyRouteProviderTests { ...@@ -109,7 +108,8 @@ class RSocketWebSocketNettyRouteProviderTests {
} }
@Bean @Bean
ServerRSocketFactoryProcessor myRSocketFactoryProcessor() { @SuppressWarnings("deprecation")
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor myRSocketFactoryProcessor() {
return (server) -> { return (server) -> {
processorCallCount++; processorCallCount++;
return server; return server;
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -49,6 +49,7 @@ class NonUniqueSessionRepositoryFailureAnalyzerTests { ...@@ -49,6 +49,7 @@ class NonUniqueSessionRepositoryFailureAnalyzerTests {
} }
@SafeVarargs @SafeVarargs
@SuppressWarnings("varargs")
private final Exception createFailure(Class<? extends SessionRepository<?>>... candidates) { private final Exception createFailure(Class<? extends SessionRepository<?>>... candidates) {
return new NonUniqueSessionRepositoryException(Arrays.asList(candidates)); return new NonUniqueSessionRepositoryException(Arrays.asList(candidates));
} }
......
...@@ -47,9 +47,6 @@ import org.springframework.boot.jms.XAConnectionFactoryWrapper; ...@@ -47,9 +47,6 @@ import org.springframework.boot.jms.XAConnectionFactoryWrapper;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor; import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostProcessor;
import org.springframework.boot.jta.atomikos.AtomikosProperties; import org.springframework.boot.jta.atomikos.AtomikosProperties;
import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor;
import org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean;
import org.springframework.boot.jta.bitronix.PoolingDataSourceBean;
import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -71,7 +68,7 @@ import static org.mockito.Mockito.mock; ...@@ -71,7 +68,7 @@ import static org.mockito.Mockito.mock;
* @author Kazuki Shimizu * @author Kazuki Shimizu
* @author Nishant Raut * @author Nishant Raut
*/ */
@SuppressWarnings("deprecation") // @SuppressWarnings("deprecation")
class JtaAutoConfigurationTests { class JtaAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
...@@ -123,7 +120,7 @@ class JtaAutoConfigurationTests { ...@@ -123,7 +120,7 @@ class JtaAutoConfigurationTests {
this.context.getBean(TransactionManager.class); this.context.getBean(TransactionManager.class);
this.context.getBean(XADataSourceWrapper.class); this.context.getBean(XADataSourceWrapper.class);
this.context.getBean(XAConnectionFactoryWrapper.class); this.context.getBean(XAConnectionFactoryWrapper.class);
this.context.getBean(BitronixDependentBeanFactoryPostProcessor.class); this.context.getBean(org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor.class);
this.context.getBean(JtaTransactionManager.class); this.context.getBean(JtaTransactionManager.class);
} }
...@@ -178,7 +175,8 @@ class JtaAutoConfigurationTests { ...@@ -178,7 +175,8 @@ class JtaAutoConfigurationTests {
"spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context); "spring.jta.bitronix.connectionfactory.maxPoolSize:10").applyTo(this.context);
this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
PoolingConnectionFactoryBean connectionFactory = this.context.getBean(PoolingConnectionFactoryBean.class); org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean connectionFactory = this.context
.getBean(org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean.class);
assertThat(connectionFactory.getMinPoolSize()).isEqualTo(5); assertThat(connectionFactory.getMinPoolSize()).isEqualTo(5);
assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10); assertThat(connectionFactory.getMaxPoolSize()).isEqualTo(10);
} }
...@@ -205,7 +203,8 @@ class JtaAutoConfigurationTests { ...@@ -205,7 +203,8 @@ class JtaAutoConfigurationTests {
.applyTo(this.context); .applyTo(this.context);
this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class); this.context.register(BitronixJtaConfiguration.class, PoolConfiguration.class);
this.context.refresh(); this.context.refresh();
PoolingDataSourceBean dataSource = this.context.getBean(PoolingDataSourceBean.class); org.springframework.boot.jta.bitronix.PoolingDataSourceBean dataSource = this.context
.getBean(org.springframework.boot.jta.bitronix.PoolingDataSourceBean.class);
assertThat(dataSource.getMinPoolSize()).isEqualTo(5); assertThat(dataSource.getMinPoolSize()).isEqualTo(5);
assertThat(dataSource.getMaxPoolSize()).isEqualTo(10); assertThat(dataSource.getMaxPoolSize()).isEqualTo(10);
} }
......
...@@ -145,13 +145,13 @@ class ServerPropertiesTests { ...@@ -145,13 +145,13 @@ class ServerPropertiesTests {
assertThat(accesslog.isRenameOnRotate()).isTrue(); assertThat(accesslog.isRenameOnRotate()).isTrue();
assertThat(accesslog.isIpv6Canonical()).isTrue(); assertThat(accesslog.isIpv6Canonical()).isTrue();
assertThat(accesslog.isRequestAttributesEnabled()).isTrue(); assertThat(accesslog.isRequestAttributesEnabled()).isTrue();
assertThat(tomcat.getRemoteIpHeader()).isEqualTo("Remote-Ip"); assertThat(tomcat.getRemoteip().getRemoteIpHeader()).isEqualTo("Remote-Ip");
assertThat(tomcat.getProtocolHeader()).isEqualTo("X-Forwarded-Protocol"); assertThat(tomcat.getRemoteip().getProtocolHeader()).isEqualTo("X-Forwarded-Protocol");
assertThat(tomcat.getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); assertThat(tomcat.getRemoteip().getInternalProxies()).isEqualTo("10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10); assertThat(tomcat.getBackgroundProcessorDelay()).hasSeconds(10);
assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<'); assertThat(tomcat.getRelaxedPathChars()).containsExactly('|', '<');
assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|'); assertThat(tomcat.getRelaxedQueryChars()).containsExactly('^', '|');
assertThat(tomcat.getUseRelativeRedirects()).isTrue(); assertThat(tomcat.isUseRelativeRedirects()).isTrue();
} }
@Test @Test
...@@ -444,13 +444,13 @@ class ServerPropertiesTests { ...@@ -444,13 +444,13 @@ class ServerPropertiesTests {
@Test @Test
void tomcatInternalProxiesMatchesDefault() { void tomcatInternalProxiesMatchesDefault() {
assertThat(this.properties.getTomcat().getInternalProxies()) assertThat(this.properties.getTomcat().getRemoteip().getInternalProxies())
.isEqualTo(new RemoteIpValve().getInternalProxies()); .isEqualTo(new RemoteIpValve().getInternalProxies());
} }
@Test @Test
void tomcatUseRelativeRedirectsDefaultsToFalse() { void tomcatUseRelativeRedirectsDefaultsToFalse() {
assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse(); assertThat(this.properties.getTomcat().isUseRelativeRedirects()).isFalse();
} }
@Test @Test
......
...@@ -233,9 +233,10 @@ class JettyWebServerFactoryCustomizerTests { ...@@ -233,9 +233,10 @@ class JettyWebServerFactoryCustomizerTests {
assertThat(threadPool).isInstanceOf(QueuedThreadPool.class); assertThat(threadPool).isInstanceOf(QueuedThreadPool.class);
QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool; QueuedThreadPool queuedThreadPool = (QueuedThreadPool) threadPool;
Jetty defaultProperties = new Jetty(); Jetty defaultProperties = new Jetty();
assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getMinThreads()); assertThat(queuedThreadPool.getMinThreads()).isEqualTo(defaultProperties.getThreads().getMin());
assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getMaxThreads()); assertThat(queuedThreadPool.getMaxThreads()).isEqualTo(defaultProperties.getThreads().getMax());
assertThat(queuedThreadPool.getIdleTimeout()).isEqualTo(defaultProperties.getThreadIdleTimeout().toMillis()); assertThat(queuedThreadPool.getIdleTimeout())
.isEqualTo(defaultProperties.getThreads().getIdleTimeout().toMillis());
} }
private CustomRequestLog getRequestLog(JettyWebServer server) { private CustomRequestLog getRequestLog(JettyWebServer server) {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -84,7 +84,7 @@ class TomcatServletWebServerFactoryCustomizerTests { ...@@ -84,7 +84,7 @@ class TomcatServletWebServerFactoryCustomizerTests {
@Test @Test
void useRelativeRedirectsCanBeConfigured() { void useRelativeRedirectsCanBeConfigured() {
bind("server.tomcat.use-relative-redirects=true"); bind("server.tomcat.use-relative-redirects=true");
assertThat(this.serverProperties.getTomcat().getUseRelativeRedirects()).isTrue(); assertThat(this.serverProperties.getTomcat().isUseRelativeRedirects()).isTrue();
TomcatWebServer server = customizeAndGetServer(); TomcatWebServer server = customizeAndGetServer();
Context context = (Context) server.getTomcat().getHost().findChildren()[0]; Context context = (Context) server.getTomcat().getHost().findChildren()[0];
assertThat(context.getUseRelativeRedirects()).isTrue(); assertThat(context.getUseRelativeRedirects()).isTrue();
......
...@@ -77,7 +77,6 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; ...@@ -77,7 +77,6 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.accept.ContentNegotiationManager; import org.springframework.web.accept.ContentNegotiationManager;
import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ContentNegotiationStrategy;
import org.springframework.web.accept.ParameterContentNegotiationStrategy; import org.springframework.web.accept.ParameterContentNegotiationStrategy;
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
...@@ -744,6 +743,7 @@ class WebMvcAutoConfigurationTests { ...@@ -744,6 +743,7 @@ class WebMvcAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void defaultPathMatching() { void defaultPathMatching() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class); RequestMappingHandlerMapping handlerMapping = context.getBean(RequestMappingHandlerMapping.class);
...@@ -754,6 +754,7 @@ class WebMvcAutoConfigurationTests { ...@@ -754,6 +754,7 @@ class WebMvcAutoConfigurationTests {
@Test @Test
@Deprecated @Deprecated
@SuppressWarnings("deprecation")
void useSuffixPatternMatch() { void useSuffixPatternMatch() {
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true", this.contextRunner.withPropertyValues("spring.mvc.pathmatch.use-suffix-pattern:true",
"spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> { "spring.mvc.pathmatch.use-registered-suffix-pattern:true").run((context) -> {
...@@ -807,12 +808,15 @@ class WebMvcAutoConfigurationTests { ...@@ -807,12 +808,15 @@ class WebMvcAutoConfigurationTests {
} }
@Test @Test
@SuppressWarnings("deprecation")
void contentNegotiationStrategySkipsPathExtension() throws Exception { void contentNegotiationStrategySkipsPathExtension() throws Exception {
ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class); ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class);
ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy( ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy(
delegate); delegate);
MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP", Boolean.TRUE); request.setAttribute(
org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP",
Boolean.TRUE);
ServletWebRequest webRequest = new ServletWebRequest(request); ServletWebRequest webRequest = new ServletWebRequest(request);
List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest); List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest);
assertThat(mediaTypes).containsOnly(MediaType.ALL); assertThat(mediaTypes).containsOnly(MediaType.ALL);
...@@ -1128,6 +1132,7 @@ class WebMvcAutoConfigurationTests { ...@@ -1128,6 +1132,7 @@ class WebMvcAutoConfigurationTests {
static class CustomConfigurer implements WebMvcConfigurer { static class CustomConfigurer implements WebMvcConfigurer {
@Override @Override
@SuppressWarnings("deprecation")
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(true); configurer.favorPathExtension(true);
} }
......
...@@ -136,6 +136,7 @@ class BasicErrorControllerIntegrationTests { ...@@ -136,6 +136,7 @@ class BasicErrorControllerIntegrationTests {
} }
@Test @Test
@SuppressWarnings("rawtypes")
void testErrorForMachineClientAlwaysParamsWithoutMessage() { void testErrorForMachineClientAlwaysParamsWithoutMessage() {
load("--server.error.include-exception=true", "--server.error.include-message=always"); load("--server.error.include-exception=true", "--server.error.include-message=always");
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(createUrl("/noMessage"), Map.class); ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(createUrl("/noMessage"), Map.class);
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -35,8 +35,6 @@ import org.apache.maven.model.Repository; ...@@ -35,8 +35,6 @@ import org.apache.maven.model.Repository;
import org.apache.maven.model.building.DefaultModelBuilder; import org.apache.maven.model.building.DefaultModelBuilder;
import org.apache.maven.model.building.DefaultModelBuilderFactory; import org.apache.maven.model.building.DefaultModelBuilderFactory;
import org.apache.maven.model.building.DefaultModelBuildingRequest; import org.apache.maven.model.building.DefaultModelBuildingRequest;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.model.building.UrlModelSource;
import org.apache.maven.model.resolution.InvalidRepositoryException; import org.apache.maven.model.resolution.InvalidRepositoryException;
import org.apache.maven.model.resolution.ModelResolver; import org.apache.maven.model.resolution.ModelResolver;
import org.apache.maven.model.resolution.UnresolvableModelException; import org.apache.maven.model.resolution.UnresolvableModelException;
...@@ -161,13 +159,13 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans ...@@ -161,13 +159,13 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
} }
private void updateDependencyResolutionContext(List<Map<String, String>> bomDependencies) { 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(); DefaultModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();
for (URI uri : uris) { for (URI uri : uris) {
try { try {
DefaultModelBuildingRequest request = new DefaultModelBuildingRequest(); DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
request.setModelResolver(new GrapeModelResolver()); request.setModelResolver(new GrapeModelResolver());
request.setModelSource(new UrlModelSource(uri.toURL())); request.setModelSource(new org.apache.maven.model.building.UrlModelSource(uri.toURL()));
request.setSystemProperties(System.getProperties()); request.setSystemProperties(System.getProperties());
Model model = modelBuilder.build(request).getEffectiveModel(); Model model = modelBuilder.build(request).getEffectiveModel();
this.resolutionContext.addDependencyManagement(new MavenModelDependencyManagement(model)); this.resolutionContext.addDependencyManagement(new MavenModelDependencyManagement(model));
...@@ -197,25 +195,28 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans ...@@ -197,25 +195,28 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
private static class GrapeModelResolver implements ModelResolver { private static class GrapeModelResolver implements ModelResolver {
@Override @Override
public ModelSource resolveModel(Parent parent) throws UnresolvableModelException { public org.apache.maven.model.building.ModelSource resolveModel(Parent parent)
throws UnresolvableModelException {
return resolveModel(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()); return resolveModel(parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
} }
@Override @Override
public ModelSource resolveModel(Dependency dependency) throws UnresolvableModelException { public org.apache.maven.model.building.ModelSource resolveModel(Dependency dependency)
throws UnresolvableModelException {
return resolveModel(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion()); return resolveModel(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion());
} }
@Override @Override
public ModelSource resolveModel(String groupId, String artifactId, String version) public org.apache.maven.model.building.ModelSource resolveModel(String groupId, String artifactId,
throws UnresolvableModelException { String version) throws UnresolvableModelException {
Map<String, String> dependency = new HashMap<>(); Map<String, String> dependency = new HashMap<>();
dependency.put("group", groupId); dependency.put("group", groupId);
dependency.put("module", artifactId); dependency.put("module", artifactId);
dependency.put("version", version); dependency.put("version", version);
dependency.put("type", "pom"); dependency.put("type", "pom");
try { try {
return new UrlModelSource(Grape.getInstance().resolve(null, dependency)[0].toURL()); return new org.apache.maven.model.building.UrlModelSource(
Grape.getInstance().resolve(null, dependency)[0].toURL());
} }
catch (MalformedURLException ex) { catch (MalformedURLException ex) {
throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version); throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version);
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,7 +32,6 @@ import org.springframework.boot.test.autoconfigure.core.AutoConfigureCache; ...@@ -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.filter.TypeExcludeFilters;
import org.springframework.boot.test.autoconfigure.json.AutoConfigureJson; import org.springframework.boot.test.autoconfigure.json.AutoConfigureJson;
import org.springframework.boot.test.context.SpringBootTest; 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.ComponentScan;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor; import org.springframework.core.annotation.AliasFor;
...@@ -55,9 +54,10 @@ import org.springframework.test.web.reactive.server.WebTestClient; ...@@ -55,9 +54,10 @@ import org.springframework.test.web.reactive.server.WebTestClient;
* {@link WebTestClient}. For more fine-grained control of WebTestClient the * {@link WebTestClient}. For more fine-grained control of WebTestClient the
* {@link AutoConfigureWebTestClient @AutoConfigureWebTestClient} annotation can be used. * {@link AutoConfigureWebTestClient @AutoConfigureWebTestClient} annotation can be used.
* <p> * <p>
* Typically {@code @WebFluxTest} is used in combination with {@link MockBean @MockBean} * Typically {@code @WebFluxTest} is used in combination with
* or {@link Import @Import} to create any collaborators required by your * {@link org.springframework.boot.test.mock.mockito.MockBean @MockBean} or
* {@code @Controller} beans. * {@link Import @Import} to create any collaborators required by your {@code @Controller}
* beans.
* <p> * <p>
* If you are looking to load your full application configuration and use WebTestClient, * If you are looking to load your full application configuration and use WebTestClient,
* you should consider {@link SpringBootTest @SpringBootTest} combined with * you should consider {@link SpringBootTest @SpringBootTest} combined with
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -109,7 +109,7 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi ...@@ -109,7 +109,7 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
private void addFilters(ConfigurableMockMvcBuilder<?> builder) { private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
FilterRegistrationBeans registrations = new FilterRegistrationBeans(this.context); FilterRegistrationBeans registrations = new FilterRegistrationBeans(this.context);
registrations.stream().map(AbstractFilterRegistrationBean.class::cast) registrations.stream().map(AbstractFilterRegistrationBean.class::cast)
.filter(AbstractFilterRegistrationBean::isEnabled) .filter(AbstractFilterRegistrationBean<?>::isEnabled)
.forEach((registration) -> addFilter(builder, registration)); .forEach((registration) -> addFilter(builder, registration));
} }
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -31,7 +31,6 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; ...@@ -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.core.AutoConfigureCache;
import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters;
import org.springframework.boot.test.context.SpringBootTest; 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.ComponentScan.Filter;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor; import org.springframework.core.annotation.AliasFor;
...@@ -56,7 +55,8 @@ import org.springframework.test.web.servlet.MockMvc; ...@@ -56,7 +55,8 @@ import org.springframework.test.web.servlet.MockMvc;
* WebDriver). For more fine-grained control of MockMVC the * WebDriver). For more fine-grained control of MockMVC the
* {@link AutoConfigureMockMvc @AutoConfigureMockMvc} annotation can be used. * {@link AutoConfigureMockMvc @AutoConfigureMockMvc} annotation can be used.
* <p> * <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} * {@link Import @Import} to create any collaborators required by your {@code @Controller}
* beans. * beans.
* <p> * <p>
......
...@@ -36,7 +36,7 @@ public final class WebServiceClientExcludeFilter ...@@ -36,7 +36,7 @@ public final class WebServiceClientExcludeFilter
protected WebServiceClientExcludeFilter(Class<?> testClass) { protected WebServiceClientExcludeFilter(Class<?> testClass) {
super(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 @Override
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -77,6 +77,7 @@ public class FilteredClassLoader extends URLClassLoader { ...@@ -77,6 +77,7 @@ public class FilteredClassLoader extends URLClassLoader {
* name of a class or a resource name. * name of a class or a resource name.
*/ */
@SafeVarargs @SafeVarargs
@SuppressWarnings("varargs")
public FilteredClassLoader(Predicate<String>... filters) { public FilteredClassLoader(Predicate<String>... filters) {
this(Arrays.asList(filters), Arrays.asList(filters)); this(Arrays.asList(filters), Arrays.asList(filters));
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.springframework.boot.test.mock.mockito; package org.springframework.boot.test.mock.mockito;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
...@@ -333,8 +332,8 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda ...@@ -333,8 +332,8 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
} }
@Override @Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, final Object bean, public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
String beanName) throws BeansException { throws BeansException {
ReflectionUtils.doWithFields(bean.getClass(), (field) -> postProcessField(bean, field)); ReflectionUtils.doWithFields(bean.getClass(), (field) -> postProcessField(bean, field));
return pvs; return pvs;
} }
......
...@@ -15,6 +15,7 @@ sourceSets { ...@@ -15,6 +15,7 @@ sourceSets {
} }
dependencies { dependencies {
testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
testImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies"))) testImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("javax.validation:validation-api") testImplementation("javax.validation:validation-api")
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,12 +19,11 @@ package org.springframework.boot.gradle.plugin; ...@@ -19,12 +19,11 @@ package org.springframework.boot.gradle.plugin;
import org.gradle.api.Action; import org.gradle.api.Action;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.maven.MavenResolver;
import org.gradle.api.plugins.MavenPlugin;
import org.gradle.api.tasks.Upload; import org.gradle.api.tasks.Upload;
/** /**
* {@link Action} that is executed in response to the {@link MavenPlugin} being applied. * {@link Action} that is executed in response to the
* {@link org.gradle.api.plugins.MavenPlugin} being applied.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
...@@ -37,8 +36,9 @@ final class MavenPluginAction implements PluginApplicationAction { ...@@ -37,8 +36,9 @@ final class MavenPluginAction implements PluginApplicationAction {
} }
@Override @Override
@SuppressWarnings("deprecation")
public Class<? extends Plugin<? extends Project>> getPluginClass() { public Class<? extends Plugin<? extends Project>> getPluginClass() {
return MavenPlugin.class; return org.gradle.api.plugins.MavenPlugin.class;
} }
@Override @Override
...@@ -50,8 +50,9 @@ final class MavenPluginAction implements PluginApplicationAction { ...@@ -50,8 +50,9 @@ final class MavenPluginAction implements PluginApplicationAction {
}); });
} }
@SuppressWarnings("deprecation")
private void clearConfigurationMappings(Upload upload) { private void clearConfigurationMappings(Upload upload) {
upload.getRepositories().withType(MavenResolver.class, upload.getRepositories().withType(org.gradle.api.artifacts.maven.MavenResolver.class,
(resolver) -> resolver.getPom().getScopeMappings().getMappings().clear()); (resolver) -> resolver.getPom().getScopeMappings().getMappings().clear());
} }
......
...@@ -208,11 +208,13 @@ public class BootJar extends Jar implements BootArchive { ...@@ -208,11 +208,13 @@ public class BootJar extends Jar implements BootArchive {
} }
@Override @Override
@Deprecated
public boolean isExcludeDevtools() { public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools(); return this.support.isExcludeDevtools();
} }
@Override @Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) { public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools); this.support.setExcludeDevtools(excludeDevtools);
} }
......
...@@ -165,11 +165,13 @@ public class BootWar extends War implements BootArchive { ...@@ -165,11 +165,13 @@ public class BootWar extends War implements BootArchive {
} }
@Override @Override
@Deprecated
public boolean isExcludeDevtools() { public boolean isExcludeDevtools() {
return this.support.isExcludeDevtools(); return this.support.isExcludeDevtools();
} }
@Override @Override
@Deprecated
public void setExcludeDevtools(boolean excludeDevtools) { public void setExcludeDevtools(boolean excludeDevtools) {
this.support.setExcludeDevtools(excludeDevtools); this.support.setExcludeDevtools(excludeDevtools);
} }
......
...@@ -81,6 +81,7 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> { ...@@ -81,6 +81,7 @@ class BootWarTests extends AbstractBootArchiveTests<BootWar> {
} }
@Test @Test
@Deprecated
void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException { void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException {
getTask().setMainClassName("com.example.Main"); getTask().setMainClassName("com.example.Main");
getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar")); getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar"));
......
...@@ -65,3 +65,9 @@ processResources { ...@@ -65,3 +65,9 @@ processResources {
dependsOn reproducibleLoaderJar dependsOn reproducibleLoaderJar
dependsOn reproducibleJarModeLayerToolsJar 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 { ...@@ -103,6 +103,7 @@ public class ExplodedArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return new EntryIterator(this.root, this.recursive, null, null); return new EntryIterator(this.root, this.recursive, null, null);
} }
...@@ -321,6 +322,7 @@ public class ExplodedArchive implements Archive { ...@@ -321,6 +322,7 @@ public class ExplodedArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return Collections.emptyIterator(); return Collections.emptyIterator();
} }
......
...@@ -81,6 +81,7 @@ public class JarFileArchive implements Archive { ...@@ -81,6 +81,7 @@ public class JarFileArchive implements Archive {
} }
@Override @Override
@Deprecated
public Iterator<Entry> iterator() { public Iterator<Entry> iterator() {
return new EntryIterator(this.jarFile.iterator(), null, null); return new EntryIterator(this.jarFile.iterator(), null, null);
} }
......
...@@ -25,6 +25,7 @@ import java.net.URLClassLoader; ...@@ -25,6 +25,7 @@ import java.net.URLClassLoader;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.Attributes; import java.util.jar.Attributes;
...@@ -289,7 +290,7 @@ class PropertiesLauncherTests { ...@@ -289,7 +290,7 @@ class PropertiesLauncherTests {
assertThat(loader.getClass().getName()).isEqualTo(TestLoader.class.getName()); assertThat(loader.getClass().getName()).isEqualTo(TestLoader.class.getName());
} }
private List<Archive> archives() throws Exception { private Iterator<Archive> archives() throws Exception {
List<Archive> archives = new ArrayList<>(); List<Archive> archives = new ArrayList<>();
String path = System.getProperty("java.class.path"); String path = System.getProperty("java.class.path");
for (String url : path.split(File.pathSeparator)) { for (String url : path.split(File.pathSeparator)) {
...@@ -298,7 +299,7 @@ class PropertiesLauncherTests { ...@@ -298,7 +299,7 @@ class PropertiesLauncherTests {
archives.add(archive); archives.add(archive);
} }
} }
return archives; return archives.iterator();
} }
private Archive archive(String url) throws IOException { private Archive archive(String url) throws IOException {
......
...@@ -148,6 +148,7 @@ class JarFileArchiveTests { ...@@ -148,6 +148,7 @@ class JarFileArchiveTests {
File file = new File(this.tempDir, "test.jar"); File file = new File(this.tempDir, "test.jar");
FileCopyUtils.copy(writeZip64Jar(), file); FileCopyUtils.copy(writeZip64Jar(), file);
try (JarFileArchive zip64Archive = new JarFileArchive(file)) { try (JarFileArchive zip64Archive = new JarFileArchive(file)) {
@SuppressWarnings("deprecation")
Iterator<Entry> entries = zip64Archive.iterator(); Iterator<Entry> entries = zip64Archive.iterator();
for (int i = 0; i < 65537; i++) { for (int i = 0; i < 65537; i++) {
assertThat(entries.hasNext()).as(i + "nth file is present").isTrue(); assertThat(entries.hasNext()).as(i + "nth file is present").isTrue();
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -46,11 +46,10 @@ public abstract class DependencyFilter extends AbstractArtifactsFilter { ...@@ -46,11 +46,10 @@ public abstract class DependencyFilter extends AbstractArtifactsFilter {
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" }) public Set<Artifact> filter(Set<Artifact> artifacts) throws ArtifactFilterException {
public Set filter(Set artifacts) throws ArtifactFilterException { Set<Artifact> result = new HashSet<>();
Set result = new HashSet(); for (Artifact artifact : artifacts) {
for (Object artifact : artifacts) { if (!filter(artifact)) {
if (!filter((Artifact) artifact)) {
result.add(artifact); result.add(artifact);
} }
} }
......
...@@ -310,7 +310,7 @@ public class SpringApplication { ...@@ -310,7 +310,7 @@ public class SpringApplication {
Banner printedBanner = printBanner(environment); Banner printedBanner = printBanner(environment);
context = createApplicationContext(); context = createApplicationContext();
exceptionReporters = getSpringFactoriesInstances(SpringBootExceptionReporter.class, exceptionReporters = getSpringFactoriesInstances(SpringBootExceptionReporter.class,
new Class[] { ConfigurableApplicationContext.class }, context); new Class<?>[] { ConfigurableApplicationContext.class }, context);
prepareContext(context, environment, listeners, applicationArguments, printedBanner); prepareContext(context, environment, listeners, applicationArguments, printedBanner);
refreshContext(context); refreshContext(context);
afterRefresh(context, applicationArguments); afterRefresh(context, applicationArguments);
......
...@@ -24,8 +24,6 @@ import java.util.Arrays; ...@@ -24,8 +24,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import io.rsocket.RSocketFactory;
import io.rsocket.RSocketFactory.ServerRSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.transport.ServerTransport; import io.rsocket.transport.ServerTransport;
import io.rsocket.transport.netty.server.CloseableChannel; import io.rsocket.transport.netty.server.CloseableChannel;
...@@ -39,7 +37,6 @@ import org.springframework.boot.rsocket.server.ConfigurableRSocketServerFactory; ...@@ -39,7 +37,6 @@ import org.springframework.boot.rsocket.server.ConfigurableRSocketServerFactory;
import org.springframework.boot.rsocket.server.RSocketServer; import org.springframework.boot.rsocket.server.RSocketServer;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.RSocketServerFactory; import org.springframework.boot.rsocket.server.RSocketServerFactory;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.http.client.reactive.ReactorResourceFactory; import org.springframework.http.client.reactive.ReactorResourceFactory;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -62,7 +59,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur ...@@ -62,7 +59,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
private Duration lifecycleTimeout; private Duration lifecycleTimeout;
private List<ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>(); @SuppressWarnings("deprecation")
private List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>();
private List<RSocketServerCustomizer> rSocketServerCustomizers = new ArrayList<>(); private List<RSocketServerCustomizer> rSocketServerCustomizers = new ArrayList<>();
...@@ -90,29 +88,32 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur ...@@ -90,29 +88,32 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
} }
/** /**
* Set {@link ServerRSocketFactoryProcessor}s that should be called to process the * Set {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
* {@link ServerRSocketFactory} while building the server. Calling this method will * that should be called to process the
* replace any existing processors. * {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server.
* Calling this method will replace any existing processors.
* @param socketFactoryProcessors processors to apply before the server starts * @param socketFactoryProcessors processors to apply before the server starts
* @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of * @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of
* 2.2.7 * 2.2.7
*/ */
@Deprecated @Deprecated
public void setSocketFactoryProcessors( public void setSocketFactoryProcessors(
Collection<? extends ServerRSocketFactoryProcessor> socketFactoryProcessors) { Collection<? extends org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors) {
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors); this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors);
} }
/** /**
* Add {@link ServerRSocketFactoryProcessor}s that should be called to process the * Add {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
* {@link ServerRSocketFactory} while building the server. * that should be called to process the
* {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server.
* @param socketFactoryProcessors processors to apply before the server starts * @param socketFactoryProcessors processors to apply before the server starts
* @deprecated in favor of * @deprecated in favor of
* {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7 * {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7
*/ */
@Deprecated @Deprecated
public void addSocketFactoryProcessors(ServerRSocketFactoryProcessor... socketFactoryProcessors) { public void addSocketFactoryProcessors(
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor... socketFactoryProcessors) {
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null"); Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors)); this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors));
} }
...@@ -154,7 +155,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur ...@@ -154,7 +155,8 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
public NettyRSocketServer create(SocketAcceptor socketAcceptor) { public NettyRSocketServer create(SocketAcceptor socketAcceptor) {
ServerTransport<CloseableChannel> transport = createTransport(); ServerTransport<CloseableChannel> transport = createTransport();
io.rsocket.core.RSocketServer server = io.rsocket.core.RSocketServer.create(socketAcceptor); io.rsocket.core.RSocketServer server = io.rsocket.core.RSocketServer.create(socketAcceptor);
RSocketFactory.ServerRSocketFactory factory = new ServerRSocketFactory(server); io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory(
server);
this.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server)); this.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server));
this.socketFactoryProcessors.forEach((processor) -> processor.process(factory)); this.socketFactoryProcessors.forEach((processor) -> processor.process(factory));
Mono<CloseableChannel> starter = server.bind(transport); Mono<CloseableChannel> starter = server.bind(transport);
......
...@@ -16,10 +16,9 @@ ...@@ -16,10 +16,9 @@
package org.springframework.boot.rsocket.server; package org.springframework.boot.rsocket.server;
import io.rsocket.RSocketFactory.ServerRSocketFactory;
/** /**
* Processor that allows for custom modification of a {@link ServerRSocketFactory * Processor that allows for custom modification of a
* {@link io.rsocket.RSocketFactory.ServerRSocketFactory
* RSocketFactory.ServerRSocketFactory} before it is used. * RSocketFactory.ServerRSocketFactory} before it is used.
* *
* @author Brian Clozel * @author Brian Clozel
...@@ -37,6 +36,6 @@ public interface ServerRSocketFactoryProcessor { ...@@ -37,6 +36,6 @@ public interface ServerRSocketFactoryProcessor {
* @param factory the factory to process * @param factory the factory to process
* @return the processed factory instance * @return the processed factory instance
*/ */
ServerRSocketFactory process(ServerRSocketFactory factory); io.rsocket.RSocketFactory.ServerRSocketFactory process(io.rsocket.RSocketFactory.ServerRSocketFactory factory);
} }
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -77,6 +77,7 @@ public class ServletContextInitializerBeans extends AbstractCollection<ServletCo ...@@ -77,6 +77,7 @@ public class ServletContextInitializerBeans extends AbstractCollection<ServletCo
private List<ServletContextInitializer> sortedList; private List<ServletContextInitializer> sortedList;
@SafeVarargs @SafeVarargs
@SuppressWarnings("varargs")
public ServletContextInitializerBeans(ListableBeanFactory beanFactory, public ServletContextInitializerBeans(ListableBeanFactory beanFactory,
Class<? extends ServletContextInitializer>... initializerTypes) { Class<? extends ServletContextInitializer>... initializerTypes) {
this.initializers = new LinkedMultiValueMap<>(); this.initializers = new LinkedMultiValueMap<>();
......
...@@ -257,7 +257,7 @@ class ConfigurationPropertiesTests { ...@@ -257,7 +257,7 @@ class ConfigurationPropertiesTests {
AnnotationConfigApplicationContext parent = load(BasicConfiguration.class, "name=parent"); AnnotationConfigApplicationContext parent = load(BasicConfiguration.class, "name=parent");
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.setParent(parent); 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(this.context.getBean(BasicProperties.class)).isNotNull();
assertThat(parent.getBean(BasicProperties.class)).isNotNull(); assertThat(parent.getBean(BasicProperties.class)).isNotNull();
assertThat(this.context.getBean(BasicPropertiesConsumer.class).getName()).isEqualTo("parent"); assertThat(this.context.getBean(BasicPropertiesConsumer.class).getName()).isEqualTo("parent");
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -97,7 +97,7 @@ class AtomikosPropertiesTests { ...@@ -97,7 +97,7 @@ class AtomikosPropertiesTests {
} }
private MapEntry<?, ?>[] defaultOf(Properties defaultSettings, String... keys) { 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++) { for (int i = 0; i < keys.length; i++) {
String key = keys[i]; String key = keys[i];
entries[i] = entry(key, defaultSettings.get(key)); entries[i] = entry(key, defaultSettings.get(key));
......
...@@ -25,7 +25,6 @@ import io.netty.buffer.PooledByteBufAllocator; ...@@ -25,7 +25,6 @@ import io.netty.buffer.PooledByteBufAllocator;
import io.rsocket.ConnectionSetupPayload; import io.rsocket.ConnectionSetupPayload;
import io.rsocket.Payload; import io.rsocket.Payload;
import io.rsocket.RSocket; import io.rsocket.RSocket;
import io.rsocket.RSocketFactory;
import io.rsocket.SocketAcceptor; import io.rsocket.SocketAcceptor;
import io.rsocket.transport.netty.client.WebsocketClientTransport; import io.rsocket.transport.netty.client.WebsocketClientTransport;
import io.rsocket.util.DefaultPayload; import io.rsocket.util.DefaultPayload;
...@@ -37,7 +36,6 @@ import reactor.core.publisher.Mono; ...@@ -37,7 +36,6 @@ import reactor.core.publisher.Mono;
import org.springframework.boot.rsocket.server.RSocketServer; import org.springframework.boot.rsocket.server.RSocketServer;
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor;
import org.springframework.core.codec.CharSequenceEncoder; import org.springframework.core.codec.CharSequenceEncoder;
import org.springframework.core.codec.StringDecoder; import org.springframework.core.codec.StringDecoder;
import org.springframework.core.io.buffer.NettyDataBufferFactory; import org.springframework.core.io.buffer.NettyDataBufferFactory;
...@@ -131,20 +129,20 @@ class NettyRSocketServerFactoryTests { ...@@ -131,20 +129,20 @@ class NettyRSocketServerFactoryTests {
} }
@Test @Test
@SuppressWarnings("deprecation") @Deprecated
void serverProcessors() { void serverProcessors() {
NettyRSocketServerFactory factory = getFactory(); NettyRSocketServerFactory factory = getFactory();
ServerRSocketFactoryProcessor[] processors = new ServerRSocketFactoryProcessor[2]; org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[] processors = new org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[2];
for (int i = 0; i < processors.length; i++) { for (int i = 0; i < processors.length; i++) {
processors[i] = mock(ServerRSocketFactoryProcessor.class); processors[i] = mock(org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor.class);
given(processors[i].process(any(RSocketFactory.ServerRSocketFactory.class))) given(processors[i].process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class)))
.will((invocation) -> invocation.getArgument(0)); .will((invocation) -> invocation.getArgument(0));
} }
factory.setSocketFactoryProcessors(Arrays.asList(processors)); factory.setSocketFactoryProcessors(Arrays.asList(processors));
this.server = factory.create(new EchoRequestResponseAcceptor()); this.server = factory.create(new EchoRequestResponseAcceptor());
InOrder ordered = inOrder((Object[]) processors); InOrder ordered = inOrder((Object[]) processors);
for (ServerRSocketFactoryProcessor processor : processors) { for (org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor processor : processors) {
ordered.verify(processor).process(any(RSocketFactory.ServerRSocketFactory.class)); ordered.verify(processor).process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class));
} }
} }
...@@ -200,6 +198,7 @@ class NettyRSocketServerFactoryTests { ...@@ -200,6 +198,7 @@ class NettyRSocketServerFactoryTests {
static class EchoRequestResponseAcceptor implements SocketAcceptor { static class EchoRequestResponseAcceptor implements SocketAcceptor {
@Override @Override
@SuppressWarnings("deprecation")
public Mono<RSocket> accept(ConnectionSetupPayload setupPayload, RSocket rSocket) { public Mono<RSocket> accept(ConnectionSetupPayload setupPayload, RSocket rSocket) {
return Mono.just(new RSocket() { return Mono.just(new RSocket() {
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment