Enable deprecation compilation warnings

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,12 @@ package org.springframework.boot.autoconfigure.jms.artemis;
import java.io.File;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.JournalType;
@@ -77,7 +77,7 @@ class ArtemisEmbeddedConfigurationFactory {
private CoreAddressConfiguration createAddressConfiguration(String name) {
return new CoreAddressConfiguration().setName(name).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(
new CoreQueueConfiguration().setName(name).setRoutingType(RoutingType.ANYCAST).setAddress(name));
new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).setAddress(name));
}
private String getDataDir() {

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.rsocket;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport;
import reactor.netty.http.server.HttpServer;
@@ -40,8 +39,10 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
* @author Brian Clozel
* @since 2.2.0
*/
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RSocketRequester.class, RSocketFactory.class, HttpServer.class, TcpServerTransport.class })
@ConditionalOnClass({ RSocketRequester.class, io.rsocket.RSocketFactory.class, HttpServer.class,
TcpServerTransport.class })
@AutoConfigureAfter(RSocketStrategiesAutoConfiguration.class)
public class RSocketRequesterAutoConfiguration {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ public class JettyWebSocketServletWebServerCustomizer
@Override
public void configure(WebAppContext context) throws Exception {
ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(context);
ServerContainer serverContainer = WebSocketServerContainerInitializer.initialize(context);
ShutdownThread.deregister(serverContainer);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ class TomcatServletWebServerFactoryCustomizerTests {
@Test
void useRelativeRedirectsCanBeConfigured() {
bind("server.tomcat.use-relative-redirects=true");
assertThat(this.serverProperties.getTomcat().getUseRelativeRedirects()).isTrue();
assertThat(this.serverProperties.getTomcat().isUseRelativeRedirects()).isTrue();
TomcatWebServer server = customizeAndGetServer();
Context context = (Context) server.getTomcat().getHost().findChildren()[0];
assertThat(context.getUseRelativeRedirects()).isTrue();

View File

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