Commit f3fa20b2 authored by Phillip Webb's avatar Phillip Webb

Polish

parent ac9c003a
...@@ -78,11 +78,9 @@ public class JerseyServerMetricsAutoConfiguration { ...@@ -78,11 +78,9 @@ public class JerseyServerMetricsAutoConfiguration {
public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizer( public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizer(
MeterRegistry meterRegistry, JerseyTagsProvider tagsProvider) { MeterRegistry meterRegistry, JerseyTagsProvider tagsProvider) {
Server server = this.properties.getWeb().getServer(); Server server = this.properties.getWeb().getServer();
return (config) -> { return (config) -> config.register(new MetricsApplicationEventListener(
config.register(new MetricsApplicationEventListener(meterRegistry, meterRegistry, tagsProvider, server.getRequestsMetricName(),
tagsProvider, server.getRequestsMetricName(), server.isAutoTimeRequests(), new AnnotationUtilsAnnotationFinder()));
server.isAutoTimeRequests(), new AnnotationUtilsAnnotationFinder()));
};
} }
@Bean @Bean
......
...@@ -28,6 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -28,6 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
public abstract class StepRegistryPropertiesTests { public abstract class StepRegistryPropertiesTests {
@SuppressWarnings("deprecation")
protected void assertStepRegistryDefaultValues(StepRegistryProperties properties, protected void assertStepRegistryDefaultValues(StepRegistryProperties properties,
StepRegistryConfig config) { StepRegistryConfig config) {
assertThat(properties.getStep()).isEqualTo(config.step()); assertThat(properties.getStep()).isEqualTo(config.step());
......
...@@ -102,9 +102,8 @@ public class TomcatMetricsAutoConfigurationTests { ...@@ -102,9 +102,8 @@ public class TomcatMetricsAutoConfigurationTests {
.withConfiguration( .withConfiguration(
AutoConfigurations.of(TomcatMetricsAutoConfiguration.class)) AutoConfigurations.of(TomcatMetricsAutoConfiguration.class))
.withUserConfiguration(MeterRegistryConfiguration.class) .withUserConfiguration(MeterRegistryConfiguration.class)
.run((context) -> { .run((context) -> assertThat(context)
assertThat(context).hasSingleBean(TomcatMetricsBinder.class); .hasSingleBean(TomcatMetricsBinder.class));
});
} }
@Test @Test
......
...@@ -40,7 +40,7 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage ...@@ -40,7 +40,7 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
* {@link ApplicationListener} to trigger early initialization in a background thread of * {@link ApplicationListener} to trigger early initialization in a background thread of
* time consuming tasks. * time consuming tasks.
* <p> * <p>
* Set the {@value IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME} system property to * Set the {@link #IGNORE_BACKGROUNDPREINITIALIZER_PROPERTY_NAME} system property to
* {@code true} to disable this mechanism and let such initialization happen in the * {@code true} to disable this mechanism and let such initialization happen in the
* foreground. * foreground.
* *
......
...@@ -168,6 +168,7 @@ public class MongoDataAutoConfiguration { ...@@ -168,6 +168,7 @@ public class MongoDataAutoConfiguration {
} }
@Override @Override
@Deprecated
public DB getLegacyDb() { public DB getLegacyDb() {
return this.mongoDbFactory.getLegacyDb(); return this.mongoDbFactory.getLegacyDb();
} }
......
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Internal {@link org.springframework.boot.diagnostics.FailureAnalyzer} implementations
* related to auto-configuration.
*/
package org.springframework.boot.autoconfigure.diagnostics.analyzer;
...@@ -22,8 +22,8 @@ import okhttp3.OkHttpClient; ...@@ -22,8 +22,8 @@ import okhttp3.OkHttpClient;
import org.influxdb.InfluxDB; import org.influxdb.InfluxDB;
/** /**
* Provide the {@link OkHttpClient.Builder} to use to customize the auto-configured * Provide the {@link okhttp3.OkHttpClient.Builder OkHttpClient.Builder} to use to
* {@link InfluxDB} instance. * customize the auto-configured {@link InfluxDB} instance.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 2.1.0 * @since 2.1.0
......
...@@ -22,7 +22,7 @@ import javax.transaction.TransactionManager; ...@@ -22,7 +22,7 @@ import javax.transaction.TransactionManager;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
...@@ -61,17 +61,21 @@ import org.springframework.util.StringUtils; ...@@ -61,17 +61,21 @@ import org.springframework.util.StringUtils;
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
public class XADataSourceAutoConfiguration implements BeanClassLoaderAware { public class XADataSourceAutoConfiguration implements BeanClassLoaderAware {
@Autowired private final XADataSourceWrapper wrapper;
private XADataSourceWrapper wrapper;
@Autowired private final DataSourceProperties properties;
private DataSourceProperties properties;
@Autowired(required = false) private final XADataSource xaDataSource;
private XADataSource xaDataSource;
private ClassLoader classLoader; private ClassLoader classLoader;
public XADataSourceAutoConfiguration(XADataSourceWrapper wrapper,
DataSourceProperties properties, ObjectProvider<XADataSource> xaDataSource) {
this.wrapper = wrapper;
this.properties = properties;
this.xaDataSource = xaDataSource.getIfAvailable();
}
@Bean @Bean
public DataSource dataSource() throws Exception { public DataSource dataSource() throws Exception {
XADataSource xaDataSource = this.xaDataSource; XADataSource xaDataSource = this.xaDataSource;
......
...@@ -29,8 +29,10 @@ import org.junit.Test; ...@@ -29,8 +29,10 @@ import org.junit.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
...@@ -59,10 +61,8 @@ public class MongoReactiveAutoConfigurationTests { ...@@ -59,10 +61,8 @@ public class MongoReactiveAutoConfigurationTests {
public void optionsAdded() { public void optionsAdded() {
this.contextRunner.withPropertyValues("spring.data.mongodb.host:localhost") this.contextRunner.withPropertyValues("spring.data.mongodb.host:localhost")
.withUserConfiguration(OptionsConfig.class) .withUserConfiguration(OptionsConfig.class)
.run((context) -> assertThat( .run((context) -> assertThat(getSettings(context).getSocketSettings()
context.getBean(MongoClient.class).getSettings() .getReadTimeout(TimeUnit.SECONDS)).isEqualTo(300));
.getSocketSettings().getReadTimeout(TimeUnit.SECONDS))
.isEqualTo(300));
} }
@Test @Test
...@@ -70,9 +70,8 @@ public class MongoReactiveAutoConfigurationTests { ...@@ -70,9 +70,8 @@ public class MongoReactiveAutoConfigurationTests {
this.contextRunner this.contextRunner
.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test") .withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test")
.withUserConfiguration(OptionsConfig.class) .withUserConfiguration(OptionsConfig.class)
.run((context) -> assertThat(context.getBean(MongoClient.class) .run((context) -> assertThat(getSettings(context).getReadPreference())
.getSettings().getReadPreference()) .isEqualTo(ReadPreference.nearest()));
.isEqualTo(ReadPreference.nearest()));
} }
@Test @Test
...@@ -81,9 +80,7 @@ public class MongoReactiveAutoConfigurationTests { ...@@ -81,9 +80,7 @@ public class MongoReactiveAutoConfigurationTests {
.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test") .withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test")
.withUserConfiguration(SslOptionsConfig.class).run((context) -> { .withUserConfiguration(SslOptionsConfig.class).run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class); assertThat(context).hasSingleBean(MongoClient.class);
MongoClient mongo = context.getBean(MongoClient.class); MongoClientSettings settings = getSettings(context);
com.mongodb.async.client.MongoClientSettings settings = mongo
.getSettings();
assertThat(settings.getApplicationName()).isEqualTo("test-config"); assertThat(settings.getApplicationName()).isEqualTo("test-config");
assertThat(settings.getStreamFactoryFactory()) assertThat(settings.getStreamFactoryFactory())
.isSameAs(context.getBean("myStreamFactoryFactory")); .isSameAs(context.getBean("myStreamFactoryFactory"));
...@@ -94,9 +91,8 @@ public class MongoReactiveAutoConfigurationTests { ...@@ -94,9 +91,8 @@ public class MongoReactiveAutoConfigurationTests {
public void nettyStreamFactoryFactoryIsConfiguredAutomatically() { public void nettyStreamFactoryFactoryIsConfiguredAutomatically() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class); assertThat(context).hasSingleBean(MongoClient.class);
assertThat(context.getBean(MongoClient.class).getSettings() assertThat(getSettings(context).getStreamFactoryFactory())
.getStreamFactoryFactory()) .isInstanceOf(NettyStreamFactoryFactory.class);
.isInstanceOf(NettyStreamFactoryFactory.class);
}); });
} }
...@@ -106,14 +102,21 @@ public class MongoReactiveAutoConfigurationTests { ...@@ -106,14 +102,21 @@ public class MongoReactiveAutoConfigurationTests {
"spring.data.mongodb.uri:mongodb://localhost/test?appname=auto-config") "spring.data.mongodb.uri:mongodb://localhost/test?appname=auto-config")
.withUserConfiguration(SimpleCustomizerConfig.class).run((context) -> { .withUserConfiguration(SimpleCustomizerConfig.class).run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class); assertThat(context).hasSingleBean(MongoClient.class);
MongoClient client = context.getBean(MongoClient.class); MongoClientSettings settings = getSettings(context);
assertThat(client.getSettings().getApplicationName()) assertThat(settings.getApplicationName())
.isEqualTo("overridden-name"); .isEqualTo("overridden-name");
assertThat(client.getSettings().getStreamFactoryFactory()) assertThat(settings.getStreamFactoryFactory())
.isEqualTo(SimpleCustomizerConfig.streamFactoryFactory); .isEqualTo(SimpleCustomizerConfig.streamFactoryFactory);
}); });
} }
@SuppressWarnings("deprecation")
private MongoClientSettings getSettings(ApplicationContext context) {
MongoClient client = context.getBean(MongoClient.class);
return (MongoClientSettings) ReflectionTestUtils.getField(client.getSettings(),
"wrapped");
}
@Configuration @Configuration
static class OptionsConfig { static class OptionsConfig {
......
...@@ -28,6 +28,7 @@ import org.junit.Test; ...@@ -28,6 +28,7 @@ import org.junit.Test;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
...@@ -113,7 +114,7 @@ public class ReactiveMongoClientFactoryTests { ...@@ -113,7 +114,7 @@ public class ReactiveMongoClientFactoryTests {
MongoProperties properties = new MongoProperties(); MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://localhost/test?retryWrites=true"); properties.setUri("mongodb://localhost/test?retryWrites=true");
MongoClient client = createMongoClient(properties); MongoClient client = createMongoClient(properties);
assertThat(client.getSettings().getRetryWrites()).isTrue(); assertThat(getSettings(client).getRetryWrites()).isTrue();
} }
@Test @Test
...@@ -190,14 +191,19 @@ public class ReactiveMongoClientFactoryTests { ...@@ -190,14 +191,19 @@ public class ReactiveMongoClientFactoryTests {
} }
private List<ServerAddress> extractServerAddresses(MongoClient client) { private List<ServerAddress> extractServerAddresses(MongoClient client) {
com.mongodb.async.client.MongoClientSettings settings = client.getSettings(); MongoClientSettings settings = getSettings(client);
ClusterSettings clusterSettings = settings.getClusterSettings(); ClusterSettings clusterSettings = settings.getClusterSettings();
return clusterSettings.getHosts(); return clusterSettings.getHosts();
} }
private MongoCredential extractMongoCredentials(MongoClient client) { private MongoCredential extractMongoCredentials(MongoClient client) {
com.mongodb.async.client.MongoClientSettings settings = client.getSettings(); return getSettings(client).getCredential();
return settings.getCredential(); }
@SuppressWarnings("deprecation")
private MongoClientSettings getSettings(MongoClient client) {
return (MongoClientSettings) ReflectionTestUtils.getField(client.getSettings(),
"wrapped");
} }
private void assertServerAddress(ServerAddress serverAddress, String expectedHost, private void assertServerAddress(ServerAddress serverAddress, String expectedHost,
......
...@@ -512,13 +512,11 @@ public class WebMvcAutoConfigurationTests { ...@@ -512,13 +512,11 @@ public class WebMvcAutoConfigurationTests {
this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfigurer.class) this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfigurer.class)
.withConfiguration( .withConfiguration(
AutoConfigurations.of(TaskExecutionAutoConfiguration.class)) AutoConfigurations.of(TaskExecutionAutoConfiguration.class))
.run((context) -> { .run((context) -> assertThat(ReflectionTestUtils.getField(
assertThat(ReflectionTestUtils.getField( context.getBean(RequestMappingHandlerAdapter.class),
context.getBean(RequestMappingHandlerAdapter.class), "taskExecutor"))
"taskExecutor")) .isSameAs(context.getBean(
.isSameAs(context.getBean( CustomAsyncTaskExecutorConfigurer.class).taskExecutor));
CustomAsyncTaskExecutorConfigurer.class).taskExecutor);
});
} }
@Test @Test
......
...@@ -23,7 +23,6 @@ import javax.servlet.Filter; ...@@ -23,7 +23,6 @@ import javax.servlet.Filter;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
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;
...@@ -108,11 +107,15 @@ public class RemoteDevToolsAutoConfiguration { ...@@ -108,11 +107,15 @@ public class RemoteDevToolsAutoConfiguration {
@ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true)
static class RemoteRestartConfiguration { static class RemoteRestartConfiguration {
@Autowired private final DevToolsProperties properties;
private DevToolsProperties properties;
@Autowired private final ServerProperties serverProperties;
private ServerProperties serverProperties;
RemoteRestartConfiguration(DevToolsProperties devToolsProperties,
ServerProperties serverProperties) {
this.properties = devToolsProperties;
this.serverProperties = serverProperties;
}
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
......
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Devtools specific logging concerns.
*/
package org.springframework.boot.devtools.logger;
...@@ -28,7 +28,7 @@ import org.apache.commons.logging.Log; ...@@ -28,7 +28,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
...@@ -75,11 +75,12 @@ public class RemoteClientConfiguration implements InitializingBean { ...@@ -75,11 +75,12 @@ public class RemoteClientConfiguration implements InitializingBean {
private final DevToolsProperties properties; private final DevToolsProperties properties;
@Value("${remoteUrl}") private final String remoteUrl;
private String remoteUrl;
public RemoteClientConfiguration(DevToolsProperties properties) { public RemoteClientConfiguration(DevToolsProperties properties,
@Value("${remoteUrl}") String remoteUrl) {
this.properties = properties; this.properties = properties;
this.remoteUrl = remoteUrl;
} }
@Bean @Bean
...@@ -134,20 +135,25 @@ public class RemoteClientConfiguration implements InitializingBean { ...@@ -134,20 +135,25 @@ public class RemoteClientConfiguration implements InitializingBean {
static class LiveReloadConfiguration static class LiveReloadConfiguration
implements ApplicationListener<ClassPathChangedEvent> { implements ApplicationListener<ClassPathChangedEvent> {
@Autowired private final DevToolsProperties properties;
private DevToolsProperties properties;
@Autowired(required = false) private final LiveReloadServer liveReloadServer;
private LiveReloadServer liveReloadServer;
@Autowired private final ClientHttpRequestFactory clientHttpRequestFactory;
private ClientHttpRequestFactory clientHttpRequestFactory;
@Value("${remoteUrl}") @Value("${remoteUrl}")
private String remoteUrl; private String remoteUrl;
private ExecutorService executor = Executors.newSingleThreadExecutor(); private ExecutorService executor = Executors.newSingleThreadExecutor();
LiveReloadConfiguration(DevToolsProperties properties,
ObjectProvider<LiveReloadServer> liveReloadServer,
ClientHttpRequestFactory clientHttpRequestFactory) {
this.properties = properties;
this.liveReloadServer = liveReloadServer.getIfAvailable();
this.clientHttpRequestFactory = clientHttpRequestFactory;
}
@Bean @Bean
@RestartScope @RestartScope
@ConditionalOnMissingBean @ConditionalOnMissingBean
...@@ -181,11 +187,15 @@ public class RemoteClientConfiguration implements InitializingBean { ...@@ -181,11 +187,15 @@ public class RemoteClientConfiguration implements InitializingBean {
@ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true)
static class RemoteRestartClientConfiguration { static class RemoteRestartClientConfiguration {
@Autowired private final DevToolsProperties properties;
private DevToolsProperties properties;
@Value("${remoteUrl}") private final String remoteUrl;
private String remoteUrl;
RemoteRestartClientConfiguration(DevToolsProperties properties,
@Value("${remoteUrl}") String remoteUrl) {
this.properties = properties;
this.remoteUrl = remoteUrl;
}
@Bean @Bean
public ClassPathFileSystemWatcher classPathFileSystemWatcher() { public ClassPathFileSystemWatcher classPathFileSystemWatcher() {
......
...@@ -111,12 +111,13 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi ...@@ -111,12 +111,13 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
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.getFilter(), .forEach((registration) -> addFilter(builder, registration));
registration.getUrlPatterns()));
} }
private void addFilter(ConfigurableMockMvcBuilder<?> builder, Filter filter, private void addFilter(ConfigurableMockMvcBuilder<?> builder,
Collection<String> urls) { AbstractFilterRegistrationBean<?> registration) {
Filter filter = registration.getFilter();
Collection<String> urls = registration.getUrlPatterns();
if (urls.isEmpty()) { if (urls.isEmpty()) {
builder.addFilters(filter); builder.addFilters(filter);
} }
......
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Web test utilities and support classes.
*/
package org.springframework.boot.test.web;
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Field value parsing for the standard Java compiler.
*/
package org.springframework.boot.configurationprocessor.fieldvalues.javac;
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Abstraction for field value parsing.
*/
package org.springframework.boot.configurationprocessor.fieldvalues;
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The configuration properties meta-data model and JSON writing support.
*/
package org.springframework.boot.configurationprocessor.metadata;
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Annotation processor to create {@code @ConfigurationProperties} meta-data files.
*/
package org.springframework.boot.configurationprocessor;
...@@ -35,10 +35,6 @@ class ZipInflaterInputStream extends InflaterInputStream { ...@@ -35,10 +35,6 @@ class ZipInflaterInputStream extends InflaterInputStream {
private boolean extraBytesWritten; private boolean extraBytesWritten;
ZipInflaterInputStream(InputStream inputStream, int size) { ZipInflaterInputStream(InputStream inputStream, int size) {
this(inputStream, new Inflater(true), size);
}
private ZipInflaterInputStream(InputStream inputStream, Inflater inflater, int size) {
super(inputStream, new Inflater(true), getInflaterBufferSize(size)); super(inputStream, new Inflater(true), getInflaterBufferSize(size));
this.available = size; this.available = size;
} }
......
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Maven plugin for Spring Boot.
*/
package org.springframework.boot.maven;
...@@ -136,7 +136,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -136,7 +136,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
SslContextBuilder builder = SslContextBuilder.forClient() SslContextBuilder builder = SslContextBuilder.forClient()
.sslProvider(SslProvider.JDK) .sslProvider(SslProvider.JDK)
.trustManager(InsecureTrustManagerFactory.INSTANCE); .trustManager(InsecureTrustManagerFactory.INSTANCE);
HttpClient client = HttpClient.create().wiretap() HttpClient client = HttpClient.create().wiretap(true)
.secure((sslContextSpec) -> sslContextSpec.sslContext(builder)); .secure((sslContextSpec) -> sslContextSpec.sslContext(builder));
return new ReactorClientHttpConnector(client); return new ReactorClientHttpConnector(client);
} }
...@@ -174,7 +174,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -174,7 +174,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
.sslProvider(SslProvider.JDK) .sslProvider(SslProvider.JDK)
.trustManager(InsecureTrustManagerFactory.INSTANCE) .trustManager(InsecureTrustManagerFactory.INSTANCE)
.keyManager(clientKeyManagerFactory); .keyManager(clientKeyManagerFactory);
HttpClient client = HttpClient.create().wiretap() HttpClient client = HttpClient.create().wiretap(true)
.secure((sslContextSpec) -> sslContextSpec.sslContext(builder)); .secure((sslContextSpec) -> sslContextSpec.sslContext(builder));
return new ReactorClientHttpConnector(client); return new ReactorClientHttpConnector(client);
} }
...@@ -232,7 +232,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -232,7 +232,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
} }
protected WebClient.Builder getWebClient() { protected WebClient.Builder getWebClient() {
return getWebClient(HttpClient.create().wiretap()); return getWebClient(HttpClient.create().wiretap(true));
} }
protected WebClient.Builder getWebClient(HttpClient client) { protected WebClient.Builder getWebClient(HttpClient client) {
...@@ -304,10 +304,11 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -304,10 +304,11 @@ public abstract class AbstractReactiveWebServerFactoryTests {
.getWebServer(new CharsHandler(3000, MediaType.TEXT_PLAIN)); .getWebServer(new CharsHandler(3000, MediaType.TEXT_PLAIN));
this.webServer.start(); this.webServer.start();
HttpClient client = HttpClient.create().wiretap().compress(true).tcpConfiguration( HttpClient client = HttpClient.create().wiretap(true).compress(true)
(tcpClient) -> tcpClient.doOnConnected((connection) -> connection .tcpConfiguration((tcpClient) -> tcpClient.doOnConnected(
.channel().pipeline().addBefore(NettyPipeline.HttpDecompressor, (connection) -> connection.channel().pipeline().addBefore(
"CompressionTest", new CompressionDetectionHandler()))); NettyPipeline.HttpDecompressor, "CompressionTest",
new CompressionDetectionHandler())));
return getWebClient(client).build(); return getWebClient(client).build();
} }
......
/*
* Copyright 2012-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Sample used for testing.
*/
package sample;
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