Commit 1e44aba7 authored by Phillip Webb's avatar Phillip Webb

Fix compiler warnings and polish

Fix various compiler warnings and apply a little polish.
parent 47543863
......@@ -43,6 +43,8 @@ import org.springframework.context.annotation.Configuration;
*
* @author Stephane Nicoll
* @since 2.1.0
* @deprecated since 2.2.0 as {@literal org.elasticsearch.client:transport} has been
* deprecated upstream
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Client.class)
......@@ -51,6 +53,7 @@ import org.springframework.context.annotation.Configuration;
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
@AutoConfigureAfter(ElasticsearchAutoConfiguration.class)
@EnableConfigurationProperties(ElasticsearchHealthIndicatorProperties.class)
@Deprecated
public class ElasticSearchClientHealthIndicatorAutoConfiguration extends
CompositeHealthIndicatorConfiguration<ElasticsearchHealthIndicator, Client> {
......
......@@ -50,6 +50,7 @@ import org.springframework.context.annotation.Configuration;
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
@AutoConfigureAfter({ JestAutoConfiguration.class,
ElasticSearchClientHealthIndicatorAutoConfiguration.class })
@Deprecated
public class ElasticSearchJestHealthIndicatorAutoConfiguration extends
CompositeHealthIndicatorConfiguration<ElasticsearchJestHealthIndicator, JestClient> {
......
......@@ -50,6 +50,7 @@ import org.springframework.context.annotation.Configuration;
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
@AutoConfigureAfter({ RestClientAutoConfiguration.class,
ElasticSearchClientHealthIndicatorAutoConfiguration.class })
@SuppressWarnings("deprecation")
public class ElasticSearchRestHealthIndicatorAutoConfiguration extends
CompositeHealthIndicatorConfiguration<ElasticsearchRestHealthIndicator, RestClient> {
......
......@@ -22,6 +22,7 @@ import java.util.List;
import org.springframework.boot.actuate.elasticsearch.ElasticsearchHealthIndicator;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* External configuration properties for {@link ElasticsearchHealthIndicator}.
......@@ -29,9 +30,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Binwei Yang
* @author Andy Wilkinson
* @since 2.0.0
* @deprecated since 2.2.0 as {@literal org.elasticsearch.client:transport} has been
* deprecated upstream
*/
@ConfigurationProperties(prefix = "management.health.elasticsearch",
ignoreUnknownFields = false)
@Deprecated
public class ElasticsearchHealthIndicatorProperties {
/**
......@@ -44,6 +48,8 @@ public class ElasticsearchHealthIndicatorProperties {
*/
private Duration responseTimeout = Duration.ofMillis(100);
@DeprecatedConfigurationProperty(
reason = "Upstream elasticsearch transport is deprected")
public List<String> getIndices() {
return this.indices;
}
......@@ -52,6 +58,8 @@ public class ElasticsearchHealthIndicatorProperties {
this.indices = indices;
}
@DeprecatedConfigurationProperty(
reason = "Upstream elasticsearch transport is deprected")
public Duration getResponseTimeout() {
return this.responseTimeout;
}
......
......@@ -36,6 +36,7 @@ import static org.mockito.Mockito.mock;
*
* @author Phillip Webb
*/
@Deprecated
public class ElasticsearchHealthIndicatorAutoConfigurationTests {
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -25,7 +25,6 @@ import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtensio
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;
......@@ -35,7 +34,6 @@ import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
......@@ -86,12 +84,14 @@ public class WebEndpointsAutoConfigurationIntegrationTests {
MongoDataAutoConfiguration.class, MongoReactiveAutoConfiguration.class,
MongoReactiveDataAutoConfiguration.class,
RepositoryRestMvcAutoConfiguration.class, HazelcastAutoConfiguration.class,
ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class, JestAutoConfiguration.class,
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class,
org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration.class,
SolrRepositoriesAutoConfiguration.class, SolrAutoConfiguration.class,
RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class,
MetricsAutoConfiguration.class })
@SpringBootConfiguration
@SuppressWarnings("deprecation")
public static class WebEndpointTestApplication {
}
......
......@@ -84,7 +84,6 @@ public class MeterRegistryConfigurerIntegrationTests {
Logger logger = ((LoggerContext) StaticLoggerBinder.getSingleton()
.getLoggerFactory()).getLogger("test-logger");
logger.error("Error.");
Map<String, MeterRegistry> registriesByName = context
.getBeansOfType(MeterRegistry.class);
assertThat(registriesByName).hasSize(1);
......
......@@ -35,7 +35,8 @@ import org.springframework.util.StringUtils;
* @author Binwei Yang
* @author Andy Wilkinson
* @since 2.0.0
* @deprecated the transport client support is deprecated in favor of other clients
* @deprecated since 2.2.0 as {@literal org.elasticsearch.client:transport} has been
* deprecated upstream
*/
@Deprecated
public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
......
......@@ -49,6 +49,7 @@ import static org.mockito.BDDMockito.given;
*
* @author Andy Wilkinson
*/
@Deprecated
public class ElasticsearchHealthIndicatorTests {
@Mock
......
......@@ -20,7 +20,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper;
import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
......@@ -28,6 +27,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoa
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.convert.support.DefaultConversionService;
import static org.mockito.Mockito.mock;
......@@ -73,8 +73,8 @@ class BaseConfiguration {
}
@Bean
public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
return new PropertyPlaceholderConfigurer();
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -22,6 +22,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.ResourceLoaderAware;
......@@ -45,7 +46,7 @@ import org.springframework.data.util.Streamable;
* @author Oliver Gierke
*/
public abstract class AbstractRepositoryConfigurationSourceSupport
implements BeanFactoryAware, ImportBeanDefinitionRegistrar, ResourceLoaderAware,
implements ImportBeanDefinitionRegistrar, BeanFactoryAware, ResourceLoaderAware,
EnvironmentAware {
private ResourceLoader resourceLoader;
......@@ -56,30 +57,20 @@ public abstract class AbstractRepositoryConfigurationSourceSupport
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
BeanDefinitionRegistry registry) {
new RepositoryConfigurationDelegate(getConfigurationSource(registry),
this.resourceLoader, this.environment).registerRepositoriesIn(registry,
getRepositoryConfigurationExtension());
BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
RepositoryConfigurationDelegate delegate = new RepositoryConfigurationDelegate(
getConfigurationSource(registry, importBeanNameGenerator),
this.resourceLoader, this.environment);
delegate.registerRepositoriesIn(registry, getRepositoryConfigurationExtension());
}
private AnnotationRepositoryConfigurationSource getConfigurationSource(
BeanDefinitionRegistry beanDefinitionRegistry) {
BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(
getConfiguration(), true);
return new AnnotationRepositoryConfigurationSource(metadata, getAnnotation(),
this.resourceLoader, this.environment, beanDefinitionRegistry) {
@Override
public Streamable<String> getBasePackages() {
return AbstractRepositoryConfigurationSourceSupport.this
.getBasePackages();
}
@Override
public BootstrapMode getBootstrapMode() {
return AbstractRepositoryConfigurationSourceSupport.this
.getBootstrapMode();
}
return new AutoConfiguredAnnotationRepositoryConfigurationSource(metadata,
getAnnotation(), this.resourceLoader, this.environment, registry,
importBeanNameGenerator) {
};
}
......@@ -129,4 +120,29 @@ public abstract class AbstractRepositoryConfigurationSourceSupport
this.environment = environment;
}
/**
* An auto-configured {@link AnnotationRepositoryConfigurationSource}.
*/
private class AutoConfiguredAnnotationRepositoryConfigurationSource
extends AnnotationRepositoryConfigurationSource {
AutoConfiguredAnnotationRepositoryConfigurationSource(AnnotationMetadata metadata,
Class<? extends Annotation> annotation, ResourceLoader resourceLoader,
Environment environment, BeanDefinitionRegistry registry,
BeanNameGenerator generator) {
super(metadata, annotation, resourceLoader, environment, registry, generator);
}
@Override
public Streamable<String> getBasePackages() {
return AbstractRepositoryConfigurationSourceSupport.this.getBasePackages();
}
@Override
public BootstrapMode getBootstrapMode() {
return AbstractRepositoryConfigurationSourceSupport.this.getBootstrapMode();
}
}
}
......@@ -42,7 +42,7 @@ import org.springframework.data.cassandra.repository.support.ReactiveCassandraRe
@ConditionalOnClass({ ReactiveSession.class, ReactiveCassandraRepository.class })
@ConditionalOnRepositoryType(store = "cassandra", type = RepositoryType.REACTIVE)
@ConditionalOnMissingBean(ReactiveCassandraRepositoryFactoryBean.class)
@Import(CassandraReactiveRepositoriesAutoConfigureRegistrar.class)
@Import(CassandraReactiveRepositoriesRegistrar.class)
@AutoConfigureAfter(CassandraReactiveDataAutoConfiguration.class)
public class CassandraReactiveRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -31,7 +31,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* @author Eddú Meléndez
* @since 2.0.0
*/
class CassandraReactiveRepositoriesAutoConfigureRegistrar
class CassandraReactiveRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -41,7 +41,7 @@ import org.springframework.data.cassandra.repository.support.CassandraRepository
@ConditionalOnClass({ Session.class, CassandraRepository.class })
@ConditionalOnRepositoryType(store = "cassandra", type = RepositoryType.IMPERATIVE)
@ConditionalOnMissingBean(CassandraRepositoryFactoryBean.class)
@Import(CassandraRepositoriesAutoConfigureRegistrar.class)
@Import(CassandraRepositoriesRegistrar.class)
public class CassandraRepositoriesAutoConfiguration {
}
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -31,7 +31,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* @author Eddú Meléndez
* @since 1.3.0
*/
class CassandraRepositoriesAutoConfigureRegistrar
class CassandraRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -46,6 +46,7 @@ import org.springframework.data.elasticsearch.repository.config.EnableElasticsea
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ Client.class, ElasticsearchTemplate.class })
@AutoConfigureAfter(ElasticsearchAutoConfiguration.class)
@SuppressWarnings("deprecation")
public class ElasticsearchDataAutoConfiguration {
@Bean
......
......@@ -54,7 +54,7 @@ public class JdbcRepositoriesAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(JdbcRepositoryConfigExtension.class)
@Import(JdbcRepositoriesAutoConfigureRegistrar.class)
@Import(JdbcRepositoriesRegistrar.class)
static class JdbcRepositoriesConfiguration {
}
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -30,7 +30,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
*
* @author Andy Wilkinson
*/
class JdbcRepositoriesAutoConfigureRegistrar
class JdbcRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -66,7 +66,7 @@ import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
JpaRepositoryConfigExtension.class })
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "enabled",
havingValue = "true", matchIfMissing = true)
@Import(JpaRepositoriesAutoConfigureRegistrar.class)
@Import(JpaRepositoriesRegistrar.class)
@AutoConfigureAfter({ HibernateJpaAutoConfiguration.class,
TaskExecutionAutoConfiguration.class })
public class JpaRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
* @author Dave Syer
*/
class JpaRepositoriesAutoConfigureRegistrar
class JpaRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
private BootstrapMode bootstrapMode = null;
......
......@@ -53,7 +53,7 @@ import org.springframework.data.mongodb.repository.support.ReactiveMongoReposito
@ConditionalOnMissingBean({ ReactiveMongoRepositoryFactoryBean.class,
ReactiveMongoRepositoryConfigurationExtension.class })
@ConditionalOnRepositoryType(store = "mongodb", type = RepositoryType.REACTIVE)
@Import(MongoReactiveRepositoriesAutoConfigureRegistrar.class)
@Import(MongoReactiveRepositoriesRegistrar.class)
@AutoConfigureAfter(MongoReactiveDataAutoConfiguration.class)
public class MongoReactiveRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -31,7 +31,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* @author Mark Paluch
* @since 2.0.0
*/
class MongoReactiveRepositoriesAutoConfigureRegistrar
class MongoReactiveRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -57,7 +57,7 @@ import org.springframework.data.mongodb.repository.support.MongoRepositoryFactor
@ConditionalOnMissingBean({ MongoRepositoryFactoryBean.class,
MongoRepositoryConfigurationExtension.class })
@ConditionalOnRepositoryType(store = "mongodb", type = RepositoryType.IMPERATIVE)
@Import(MongoRepositoriesAutoConfigureRegistrar.class)
@Import(MongoRepositoriesRegistrar.class)
@AutoConfigureAfter(MongoDataAutoConfiguration.class)
public class MongoRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
......@@ -30,7 +30,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
*
* @author Dave Syer
*/
class MongoRepositoriesAutoConfigureRegistrar
class MongoRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -54,7 +54,7 @@ import org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactoryB
Neo4jRepositoryConfigurationExtension.class })
@ConditionalOnProperty(prefix = "spring.data.neo4j.repositories", name = "enabled",
havingValue = "true", matchIfMissing = true)
@Import(Neo4jRepositoriesAutoConfigureRegistrar.class)
@Import(Neo4jRepositoriesRegistrar.class)
@AutoConfigureAfter(Neo4jDataAutoConfiguration.class)
public class Neo4jRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
......@@ -30,7 +30,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
*
* @author Michael Hunger
*/
class Neo4jRepositoriesAutoConfigureRegistrar
class Neo4jRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -43,7 +43,7 @@ import org.springframework.data.redis.repository.support.RedisRepositoryFactoryB
@ConditionalOnProperty(prefix = "spring.data.redis.repositories", name = "enabled",
havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean(RedisRepositoryFactoryBean.class)
@Import(RedisRepositoriesAutoConfigureRegistrar.class)
@Import(RedisRepositoriesRegistrar.class)
@AutoConfigureAfter(RedisAutoConfiguration.class)
public class RedisRepositoriesAutoConfiguration {
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -31,7 +31,7 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* @author Eddú Meléndez
* @since 1.4.0
*/
class RedisRepositoriesAutoConfigureRegistrar
class RedisRepositoriesRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
......
......@@ -79,11 +79,6 @@ public class ServerProperties {
@NestedConfigurationProperty
private final ErrorProperties error = new ErrorProperties();
/**
* Whether X-Forwarded-* headers should be applied to the HttpRequest.
*/
private Boolean useForwardHeaders;
/**
* Strategy for handling X-Forwarded-* headers.
*/
......@@ -139,18 +134,15 @@ public class ServerProperties {
this.address = address;
}
@DeprecatedConfigurationProperty
@DeprecatedConfigurationProperty(reason = "replaced to support additional strategies",
replacement = "server.forward-headers-strategy")
public Boolean isUseForwardHeaders() {
return ForwardHeadersStrategy.NATIVE.equals(this.forwardHeadersStrategy);
}
public void setUseForwardHeaders(Boolean useForwardHeaders) {
if (useForwardHeaders != null && useForwardHeaders) {
this.forwardHeadersStrategy = ForwardHeadersStrategy.NATIVE;
}
else {
this.forwardHeadersStrategy = ForwardHeadersStrategy.NONE;
}
this.forwardHeadersStrategy = Boolean.TRUE.equals(useForwardHeaders)
? ForwardHeadersStrategy.NATIVE : ForwardHeadersStrategy.NONE;
}
public String getServerHeader() {
......@@ -1358,6 +1350,9 @@ public class ServerProperties {
}
/**
* Strategies for supporting forward headers.
*/
public enum ForwardHeadersStrategy {
/**
......
......@@ -40,6 +40,7 @@ import static org.mockito.Mockito.mock;
* @author Phillip Webb
* @author Andy Wilkinson
*/
@Deprecated
public class ElasticsearchAutoConfigurationTests {
@ClassRule
......
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
......@@ -36,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Phillip Webb
* @author Artur Konczak
*/
@SuppressWarnings("deprecation")
public class ElasticsearchDataAutoConfigurationTests {
@ClassRule
......
......@@ -48,6 +48,7 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
* @author Andy Wilkinson
*/
@Deprecated
public class JestAutoConfigurationTests {
@ClassRule
......
......@@ -72,8 +72,8 @@ public class RestClientAutoConfigurationTests {
.run((context) -> {
assertThat(context).hasSingleBean(RestClient.class);
RestClient restClient = context.getBean(RestClient.class);
assertThat(restClient)
.hasFieldOrPropertyWithValue("maxRetryTimeoutMillis", 42L);
assertThat(restClient).hasFieldOrPropertyWithValue("pathPrefix",
"/test");
});
}
......@@ -146,7 +146,7 @@ public class RestClientAutoConfigurationTests {
@Bean
public RestClientBuilderCustomizer myCustomizer() {
return (builder) -> builder.setMaxRetryTimeoutMillis(42);
return (builder) -> builder.setPathPrefix("/test");
}
}
......
......@@ -47,7 +47,7 @@ public class MongoClientFactoryTests {
MongoProperties properties = new MongoProperties();
properties.setPort(12345);
MongoClient client = createMongoClient(properties);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "localhost", 12345);
}
......@@ -57,7 +57,7 @@ public class MongoClientFactoryTests {
MongoProperties properties = new MongoProperties();
properties.setHost("mongo.example.com");
MongoClient client = createMongoClient(properties);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "mongo.example.com", 27017);
}
......@@ -68,8 +68,7 @@ public class MongoClientFactoryTests {
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
MongoClient client = createMongoClient(properties);
assertMongoCredential(client.getCredentialsList().get(0), "user", "secret",
"test");
assertMongoCredential(getCredentials(client).get(0), "user", "secret", "test");
}
@Test
......@@ -79,8 +78,7 @@ public class MongoClientFactoryTests {
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
MongoClient client = createMongoClient(properties);
assertMongoCredential(client.getCredentialsList().get(0), "user", "secret",
"foo");
assertMongoCredential(getCredentials(client).get(0), "user", "secret", "foo");
}
@Test
......@@ -90,8 +88,7 @@ public class MongoClientFactoryTests {
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
MongoClient client = createMongoClient(properties);
assertMongoCredential(client.getCredentialsList().get(0), "user", "secret",
"foo");
assertMongoCredential(getCredentials(client).get(0), "user", "secret", "foo");
}
@Test
......@@ -100,11 +97,11 @@ public class MongoClientFactoryTests {
properties.setUri("mongodb://user:secret@mongo1.example.com:12345,"
+ "mongo2.example.com:23456/test");
MongoClient client = createMongoClient(properties);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(2);
assertServerAddress(allAddresses.get(0), "mongo1.example.com", 12345);
assertServerAddress(allAddresses.get(1), "mongo2.example.com", 23456);
List<MongoCredential> credentialsList = client.getCredentialsList();
List<MongoCredential> credentialsList = getCredentials(client);
assertThat(credentialsList).hasSize(1);
assertMongoCredential(credentialsList.get(0), "user", "secret", "test");
}
......@@ -115,7 +112,7 @@ public class MongoClientFactoryTests {
properties.setUri("mongodb://mongo.example.com:1234/mydb");
this.environment.setProperty("local.mongo.port", "4000");
MongoClient client = createMongoClient(properties, this.environment);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "localhost", 4000);
}
......@@ -129,6 +126,20 @@ public class MongoClientFactoryTests {
return new MongoClientFactory(properties, environment).createMongoClient(null);
}
@SuppressWarnings("deprecation")
private List<ServerAddress> getAllAddresses(MongoClient client) {
// At some point we'll probably need to use reflection to find the address but for
// now, we can use the deprecated getAllAddress method.
return client.getAllAddress();
}
@SuppressWarnings("deprecation")
private List<MongoCredential> getCredentials(MongoClient client) {
// At some point we'll probably need to use reflection to find the credentials but
// for now, we can use the deprecated getCredentialsList method.
return client.getCredentialsList();
}
private void assertServerAddress(ServerAddress serverAddress, String expectedHost,
int expectedPort) {
assertThat(serverAddress.getHost()).isEqualTo(expectedHost);
......
......@@ -118,7 +118,7 @@ public class MongoPropertiesTests {
properties.setUri("mongodb://mongo1.example.com:12345");
MongoClient client = new MongoClientFactory(properties, null)
.createMongoClient(null);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "mongo1.example.com", 12345);
}
......@@ -130,7 +130,7 @@ public class MongoPropertiesTests {
properties.setPort(27017);
MongoClient client = new MongoClientFactory(properties, null)
.createMongoClient(null);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "localhost", 27017);
}
......@@ -141,7 +141,7 @@ public class MongoPropertiesTests {
properties.setUri("mongodb://mongo1.example.com:12345");
MongoClient client = new MongoClientFactory(properties, null)
.createMongoClient(null);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "mongo1.example.com", 12345);
}
......@@ -151,11 +151,18 @@ public class MongoPropertiesTests {
MongoProperties properties = new MongoProperties();
MongoClient client = new MongoClientFactory(properties, null)
.createMongoClient(null);
List<ServerAddress> allAddresses = client.getAllAddress();
List<ServerAddress> allAddresses = getAllAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "localhost", 27017);
}
@SuppressWarnings("deprecation")
private List<ServerAddress> getAllAddresses(MongoClient client) {
// At some point we'll probably need to use reflection to find the address but for
// now, we can use the deprecated getAllAddress method.
return client.getAllAddress();
}
@Test
public void canBindAutoIndexCreation() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
......
......@@ -107,7 +107,7 @@ public class EmbeddedMongoAutoConfigurationTests {
MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer
.valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
assertThat(getPort(client)).isEqualTo(mongoPort);
}
@Test
......@@ -117,7 +117,7 @@ public class EmbeddedMongoAutoConfigurationTests {
MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer
.valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
assertThat(getPort(client)).isEqualTo(mongoPort);
}
@Test
......@@ -126,7 +126,7 @@ public class EmbeddedMongoAutoConfigurationTests {
MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer
.valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
assertThat(getPort(client)).isEqualTo(mongoPort);
}
@Test
......@@ -237,6 +237,13 @@ public class EmbeddedMongoAutoConfigurationTests {
return File.separatorChar == '\\';
}
@SuppressWarnings("deprecation")
private int getPort(MongoClient client) {
// At some point we'll probably need to use reflection to find the address but for
// now, we can use the deprecated getAddress method.
return client.getAddress().getPort();
}
@Configuration(proxyBeanMethods = false)
static class MongoClientConfiguration {
......
......@@ -49,6 +49,8 @@ public class JpaPropertiesTests {
.withUserConfiguration(TestConfiguration.class);
@Test
@Deprecated
@SuppressWarnings("deprecation")
public void determineDatabaseNoCheckIfDatabaseIsSet() {
this.contextRunner.withPropertyValues("spring.jpa.database=postgresql")
.run(assertJpaProperties((properties) -> {
......@@ -65,6 +67,8 @@ public class JpaPropertiesTests {
}
@Test
@Deprecated
@SuppressWarnings("deprecation")
public void determineDatabaseWithKnownUrl() {
this.contextRunner.run(assertJpaProperties((properties) -> {
Database database = properties
......@@ -74,6 +78,8 @@ public class JpaPropertiesTests {
}
@Test
@Deprecated
@SuppressWarnings("deprecation")
public void determineDatabaseWithKnownUrlAndUserConfig() {
this.contextRunner.withPropertyValues("spring.jpa.database=mysql")
.run(assertJpaProperties((properties) -> {
......@@ -84,6 +90,8 @@ public class JpaPropertiesTests {
}
@Test
@Deprecated
@SuppressWarnings("deprecation")
public void determineDatabaseWithUnknownUrl() {
this.contextRunner.run(assertJpaProperties((properties) -> {
Database database = properties
......
......@@ -303,7 +303,7 @@ public class ReactiveWebServerFactoryAutoConfigurationTests {
static class TomcatProtocolHandlerCustomizerConfiguration {
@Bean
public TomcatProtocolHandlerCustomizer protocolHandlerCustomizer() {
public TomcatProtocolHandlerCustomizer<?> protocolHandlerCustomizer() {
return (protocolHandler) -> {
};
}
......
......@@ -417,7 +417,7 @@ public class ServletWebServerFactoryAutoConfigurationTests {
static class TomcatProtocolHandlerCustomizerConfiguration {
@Bean
public TomcatProtocolHandlerCustomizer protocolHandlerCustomizer() {
public TomcatProtocolHandlerCustomizer<?> protocolHandlerCustomizer() {
return (protocolHandler) -> {
};
}
......
......@@ -117,6 +117,9 @@ public class JsonTestersAutoConfiguration {
/**
* {@link FactoryBean} used to create JSON Tester instances.
*
* @param <T> the object type
* @param <M> the marshaller type
*/
static class JsonTesterFactoryBean<T, M> implements FactoryBean<T> {
......
......@@ -108,7 +108,6 @@ class ImportsContextCustomizer implements ContextCustomizer {
throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
}
@SuppressWarnings("unchecked")
private BeanDefinition registerBean(BeanDefinitionRegistry registry,
AnnotatedBeanDefinitionReader reader, String beanName, Class<?> type) {
reader.registerBean(type, beanName);
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -54,7 +54,8 @@ public interface ApplicationContextAssertProvider<C extends ApplicationContext>
/**
* Return an assert for AspectJ.
* @return an AspectJ assert
* @deprecated use standard AssertJ {@code assertThat(context)...} calls instead.
* @deprecated to prevent accidental use. Prefer standard AssertJ
* {@code assertThat(context)...} calls instead.
*/
@Deprecated
@Override
......
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
......@@ -55,8 +55,8 @@ public final class JsonContent<T> implements AssertProvider<JsonContentAssert> {
/**
* Use AssertJ's {@link org.assertj.core.api.Assertions#assertThat assertThat}
* instead.
* @deprecated in favor of AssertJ's {@link org.assertj.core.api.Assertions#assertThat
* assertThat}
* @deprecated to prevent accidental use. Prefer standard AssertJ
* {@code assertThat(context)...} calls instead.
*/
@Override
@Deprecated
......
......@@ -29,6 +29,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link TestRestTemplateContextCustomizer} to ensure
* early-initialization of factory beans doesn't occur.
......@@ -47,6 +49,7 @@ public class TestRestTemplateContextCustomizerWithFactoryBeanTests {
@Test
public void test() {
assertThat(this.restTemplate).isNotNull();
}
@Configuration
......
......@@ -21,9 +21,13 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
/**
* A simple factory bean with no generics. Used to test early initialization doesn't
* occur.
*
* @author Madhura Bhave
*/
@Component
@SuppressWarnings("rawtypes")
public class SimpleFactoryBean implements FactoryBean {
private static boolean isInitializedEarly = false;
......@@ -40,10 +44,12 @@ public class SimpleFactoryBean implements FactoryBean {
}
}
@Override
public Object getObject() {
return new Object();
}
@Override
public Class<?> getObjectType() {
return Object.class;
}
......
......@@ -24,7 +24,6 @@ import javax.lang.model.element.VariableElement;
import org.junit.Test;
import org.springframework.boot.configurationsample.simple.DeprecatedProperties;
import org.springframework.boot.configurationsample.simple.DeprecatedSingleProperty;
import org.springframework.boot.configurationsample.simple.SimpleCollectionProperties;
import org.springframework.boot.configurationsample.simple.SimpleProperties;
......@@ -196,11 +195,12 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
@Test
@SuppressWarnings("deprecation")
public void javaBeanDeprecatedPropertyOnClass() throws IOException {
process(DeprecatedProperties.class, (roundEnv, metadataEnv) -> {
TypeElement ownerElement = roundEnv
.getRootElement(DeprecatedProperties.class);
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement,
"name");
process(org.springframework.boot.configurationsample.simple.DeprecatedProperties.class,
(roundEnv, metadataEnv) -> {
TypeElement ownerElement = roundEnv.getRootElement(
org.springframework.boot.configurationsample.simple.DeprecatedProperties.class);
JavaBeanPropertyDescriptor property = createPropertyDescriptor(
ownerElement, "name");
assertItemMetadata(metadataEnv, property).isProperty()
.isDeprecatedWithNoInformation();
});
......
......@@ -25,7 +25,6 @@ import javax.lang.model.element.VariableElement;
import org.junit.Test;
import org.springframework.boot.configurationsample.lombok.LombokDefaultValueProperties;
import org.springframework.boot.configurationsample.lombok.LombokDeprecatedProperties;
import org.springframework.boot.configurationsample.lombok.LombokDeprecatedSingleProperty;
import org.springframework.boot.configurationsample.lombok.LombokExplicitProperties;
import org.springframework.boot.configurationsample.lombok.LombokInnerClassProperties;
......@@ -229,11 +228,12 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
@Test
@SuppressWarnings("deprecation")
public void lombokDeprecatedPropertyOnClass() throws IOException {
process(LombokDeprecatedProperties.class, (roundEnv, metadataEnv) -> {
TypeElement ownerElement = roundEnv
.getRootElement(LombokDeprecatedProperties.class);
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement,
"name");
process(org.springframework.boot.configurationsample.lombok.LombokDeprecatedProperties.class,
(roundEnv, metadataEnv) -> {
TypeElement ownerElement = roundEnv.getRootElement(
org.springframework.boot.configurationsample.lombok.LombokDeprecatedProperties.class);
LombokPropertyDescriptor property = createPropertyDescriptor(
ownerElement, "name");
assertItemMetadata(metadataEnv, property).isProperty()
.isDeprecatedWithNoInformation();
});
......
......@@ -23,6 +23,7 @@ import java.util.Map;
* A pojo with a complex generic signature.
*
* @author Stephane Nicoll
* @param <T> the generic type
*/
public class UpperBoundGenericPojo<T extends Enum<T>> {
......
......@@ -26,6 +26,7 @@ import org.springframework.boot.configurationsample.DefaultValue;
*
* @author Stephane Nicoll
*/
@SuppressWarnings("unused")
public class ImmutableCollectionProperties {
private final List<String> names;
......
......@@ -27,6 +27,7 @@ import org.springframework.boot.configurationsample.ConfigurationProperties;
*/
@Data
@ConfigurationProperties("default")
@SuppressWarnings("unused")
public class LombokDefaultValueProperties {
private String description = "my description";
......
......@@ -30,6 +30,7 @@ import org.springframework.boot.configurationsample.ConfigurationProperties;
@Setter
@ConfigurationProperties(prefix = "deprecated")
@Deprecated
@SuppressWarnings("unused")
public class LombokDeprecatedProperties {
private String name;
......
......@@ -27,6 +27,7 @@ import org.springframework.boot.configurationsample.ConfigurationProperties;
*/
@Data
@ConfigurationProperties("singledeprecated")
@SuppressWarnings("unused")
public class LombokDeprecatedSingleProperty {
@Deprecated
......
......@@ -55,7 +55,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
/**
* The bean name of the configuration properties validator.
* @deprecated see
* @deprecated since 2.2.0 in favor of
* {@link ConfigurationPropertiesBindingPostProcessorRegistrar#VALIDATOR_BEAN_NAME}
*/
@Deprecated
......
......@@ -29,7 +29,7 @@ import org.springframework.messaging.rsocket.RSocketStrategies;
public interface RSocketStrategiesCustomizer {
/**
* Callback to customize a {@link RSocketStrategies.Builder} instance.
* Callback to customize a {@link RSocketStrategies#builder()} instance.
* @param strategies rSocket codec strategies to customize
*/
void customize(RSocketStrategies.Builder strategies);
......
......@@ -72,6 +72,7 @@ public interface ConfigurableTomcatWebServerFactory extends ConfigurableWebServe
* Add {@link TomcatProtocolHandlerCustomizer}s that should be added to the Tomcat
* {@link Connector}.
* @param tomcatProtocolHandlerCustomizers the customizers to add
* @since 2.2.0
*/
void addProtocolHandlerCustomizers(
TomcatProtocolHandlerCustomizer<?>... tomcatProtocolHandlerCustomizers);
......
......@@ -292,6 +292,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac
* Set {@link TomcatProtocolHandlerCustomizer}s that should be applied to the Tomcat
* {@link Connector}. Calling this method will replace any existing customizers.
* @param tomcatProtocolHandlerCustomizers the customizers to set
* @since 2.2.0
*/
public void setTomcatProtocolHandlerCustomizers(
Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers) {
......@@ -305,6 +306,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac
* Add {@link TomcatProtocolHandlerCustomizer}s that should be added to the Tomcat
* {@link Connector}.
* @param tomcatProtocolHandlerCustomizers the customizers to add
* @since 2.2.0
*/
@Override
public void addProtocolHandlerCustomizers(
......@@ -319,6 +321,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac
* Returns a mutable collection of the {@link TomcatProtocolHandlerCustomizer}s that
* will be applied to the Tomcat {@link Connector}.
* @return the customizers that will be applied
* @since 2.2.0
*/
public Collection<TomcatProtocolHandlerCustomizer<?>> getTomcatProtocolHandlerCustomizers() {
return this.tomcatProtocolHandlerCustomizers;
......
......@@ -636,6 +636,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
* Set {@link TomcatProtocolHandlerCustomizer}s that should be applied to the Tomcat
* {@link Connector}. Calling this method will replace any existing customizers.
* @param tomcatProtocolHandlerCustomizer the customizers to set
* @since 2.2.0
*/
public void setTomcatProtocolHandlerCustomizers(
Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizer) {
......@@ -649,6 +650,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
* Add {@link TomcatProtocolHandlerCustomizer}s that should be added to the Tomcat
* {@link Connector}.
* @param tomcatProtocolHandlerCustomizers the customizers to add
* @since 2.2.0
*/
@Override
public void addProtocolHandlerCustomizers(
......@@ -663,6 +665,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
* Returns a mutable collection of the {@link TomcatProtocolHandlerCustomizer}s that
* will be applied to the Tomcat {@link Connector}.
* @return the customizers that will be applied
* @since 2.2.0
*/
public Collection<TomcatProtocolHandlerCustomizer<?>> getTomcatProtocolHandlerCustomizers() {
return this.tomcatProtocolHandlerCustomizers;
......
......@@ -58,14 +58,14 @@ public class CompressionConnectorCustomizerTests {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.addUpgradeProtocol(new Http2Protocol());
compressionConnectorCustomizer.customize(connector);
AbstractHttp11Protocol abstractHttp11Protocol = (AbstractHttp11Protocol) connector
AbstractHttp11Protocol<?> abstractHttp11Protocol = (AbstractHttp11Protocol<?>) connector
.getProtocolHandler();
verifyHttp1(abstractHttp11Protocol);
Http2Protocol http2Protocol = (Http2Protocol) connector.findUpgradeProtocols()[0];
verifyHttp2Upgrade(http2Protocol);
}
private void verifyHttp1(AbstractHttp11Protocol protocol) {
private void verifyHttp1(AbstractHttp11Protocol<?> protocol) {
compressionOn(protocol.getCompression());
minSize(protocol.getCompressionMinSize());
mimeType(protocol.getCompressibleMimeTypes());
......
......@@ -159,10 +159,11 @@ public class TomcatReactiveWebServerFactoryTests
}
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void tomcatProtocolHandlerCustomizersShouldBeInvoked() {
TomcatReactiveWebServerFactory factory = getFactory();
HttpHandler handler = mock(HttpHandler.class);
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol>[] customizers = new TomcatProtocolHandlerCustomizer[4];
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol<?>>[] customizers = new TomcatProtocolHandlerCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(TomcatProtocolHandlerCustomizer.class));
factory.setTomcatProtocolHandlerCustomizers(
Arrays.asList(customizers[0], customizers[1]));
......
......@@ -201,9 +201,10 @@ public class TomcatServletWebServerFactoryTests
}
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void tomcatProtocolHandlerCustomizersShouldBeInvoked() {
TomcatServletWebServerFactory factory = getFactory();
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol>[] customizers = new TomcatProtocolHandlerCustomizer[4];
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol<?>>[] customizers = new TomcatProtocolHandlerCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(TomcatProtocolHandlerCustomizer.class));
factory.setTomcatProtocolHandlerCustomizers(
Arrays.asList(customizers[0], customizers[1]));
......@@ -218,13 +219,13 @@ public class TomcatServletWebServerFactoryTests
@Test
public void tomcatProtocolHandlerCanBeCustomized() {
TomcatServletWebServerFactory factory = getFactory();
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol> customizer = (
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol<?>> customizer = (
protocolHandler) -> protocolHandler.setProcessorCache(250);
factory.addProtocolHandlerCustomizers(customizer);
Tomcat tomcat = getTomcat(factory);
Connector connector = ((TomcatWebServer) this.webServer).getServiceConnectors()
.get(tomcat.getService())[0];
AbstractHttp11Protocol protocolHandler = (AbstractHttp11Protocol) connector
AbstractHttp11Protocol<?> protocolHandler = (AbstractHttp11Protocol<?>) connector
.getProtocolHandler();
assertThat(protocolHandler.getProcessorCache()).isEqualTo(250);
}
......
......@@ -66,8 +66,6 @@ public class DevToolsWithLazyInitializationIntegrationTests {
private final ApplicationLauncher applicationLauncher;
private String[] args;
@Rule
public JvmLauncher javaLauncher = new JvmLauncher();
......
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