Merge pull request #14449 from izeye:polish-20180913
* pr/14449: Polish
This commit is contained in:
commit
aeae139c65
|
|
@ -55,7 +55,7 @@ public class BackgroundPreinitializer
|
|||
|
||||
/**
|
||||
* System property that instructs Spring Boot how to run pre initialization. When the
|
||||
* property is set to {@code true}, no pre intialization happens and each item is
|
||||
* property is set to {@code true}, no pre-initialization happens and each item is
|
||||
* initialized in the foreground as it needs to. When the property is {@code false}
|
||||
* (default), pre initialization runs in a separate thread in the background.
|
||||
* @since 2.1.0
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class HttpProperties {
|
|||
/**
|
||||
* HTTP encoding properties.
|
||||
*/
|
||||
private Encoding encoding = new Encoding();
|
||||
private final Encoding encoding = new Encoding();
|
||||
|
||||
public boolean isLogRequestDetails() {
|
||||
return this.logRequestDetails;
|
||||
|
|
@ -57,10 +57,6 @@ public class HttpProperties {
|
|||
return this.encoding;
|
||||
}
|
||||
|
||||
public void setEncoding(Encoding encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration properties for http encoding.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -117,38 +117,33 @@ public class ConcurrentKafkaListenerContainerFactoryConfigurer {
|
|||
|
||||
private void configureListenerFactory(
|
||||
ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
PropertyMapper map = PropertyMapper.get();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
Listener properties = this.properties.getListener();
|
||||
map.from(properties::getConcurrency).whenNonNull().to(factory::setConcurrency);
|
||||
map.from(this.messageConverter).whenNonNull().to(factory::setMessageConverter);
|
||||
map.from(this.replyTemplate).whenNonNull().to(factory::setReplyTemplate);
|
||||
map.from(properties::getConcurrency).to(factory::setConcurrency);
|
||||
map.from(this.messageConverter).to(factory::setMessageConverter);
|
||||
map.from(this.replyTemplate).to(factory::setReplyTemplate);
|
||||
map.from(properties::getType).whenEqualTo(Listener.Type.BATCH)
|
||||
.toCall(() -> factory.setBatchListener(true));
|
||||
map.from(this.errorHandler).whenNonNull().to(factory::setErrorHandler);
|
||||
map.from(this.afterRollbackProcessor).whenNonNull()
|
||||
.to(factory::setAfterRollbackProcessor);
|
||||
map.from(this.errorHandler).to(factory::setErrorHandler);
|
||||
map.from(this.afterRollbackProcessor).to(factory::setAfterRollbackProcessor);
|
||||
}
|
||||
|
||||
private void configureContainer(ContainerProperties container) {
|
||||
PropertyMapper map = PropertyMapper.get();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
Listener properties = this.properties.getListener();
|
||||
map.from(properties::getAckMode).whenNonNull().to(container::setAckMode);
|
||||
map.from(properties::getClientId).whenNonNull().to(container::setClientId);
|
||||
map.from(properties::getAckCount).whenNonNull().to(container::setAckCount);
|
||||
map.from(properties::getAckTime).whenNonNull().as(Duration::toMillis)
|
||||
.to(container::setAckTime);
|
||||
map.from(properties::getPollTimeout).whenNonNull().as(Duration::toMillis)
|
||||
map.from(properties::getAckMode).to(container::setAckMode);
|
||||
map.from(properties::getClientId).to(container::setClientId);
|
||||
map.from(properties::getAckCount).to(container::setAckCount);
|
||||
map.from(properties::getAckTime).as(Duration::toMillis).to(container::setAckTime);
|
||||
map.from(properties::getPollTimeout).as(Duration::toMillis)
|
||||
.to(container::setPollTimeout);
|
||||
map.from(properties::getNoPollThreshold).whenNonNull()
|
||||
.to(container::setNoPollThreshold);
|
||||
map.from(properties::getIdleEventInterval).whenNonNull().as(Duration::toMillis)
|
||||
map.from(properties::getNoPollThreshold).to(container::setNoPollThreshold);
|
||||
map.from(properties::getIdleEventInterval).as(Duration::toMillis)
|
||||
.to(container::setIdleEventInterval);
|
||||
map.from(properties::getMonitorInterval).whenNonNull().as(Duration::getSeconds)
|
||||
map.from(properties::getMonitorInterval).as(Duration::getSeconds)
|
||||
.as(Number::intValue).to(container::setMonitorInterval);
|
||||
map.from(properties::getLogContainerConfig).whenNonNull()
|
||||
.to(container::setLogContainerConfig);
|
||||
map.from(this.transactionManager).whenNonNull()
|
||||
.to(container::setTransactionManager);
|
||||
map.from(properties::getLogContainerConfig).to(container::setLogContainerConfig);
|
||||
map.from(this.transactionManager).to(container::setTransactionManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class OnPropertyListConditionTests {
|
|||
|
||||
@Test
|
||||
public void propertyDefinedAsCommaSeparatedRelaxed() {
|
||||
this.contextRunner.withPropertyValues("spring.test.my-list=value1")
|
||||
this.contextRunner.withPropertyValues("spring.test.myList=value1")
|
||||
.run((context) -> assertThat(context).hasBean("foo"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@ public class OnWsdlLocationsConditionTests {
|
|||
.withUserConfiguration(TestConfig.class);
|
||||
|
||||
@Test
|
||||
public void bootstrapHostsNotDefined() {
|
||||
public void wsdlLocationsNotDefined() {
|
||||
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean("foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapHostsDefinedAsCommaSeparated() {
|
||||
public void wsdlLocationsDefinedAsCommaSeparated() {
|
||||
this.contextRunner.withPropertyValues("spring.webservices.wsdl-locations=value1")
|
||||
.run((context) -> assertThat(context).hasBean("foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapHostsDefinedAsList() {
|
||||
public void wsdlLocationsDefinedAsList() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.webservices.wsdl-locations[0]=value1")
|
||||
.run((context) -> assertThat(context).hasBean("foo"));
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ public class WebServicesAutoConfigurationTests {
|
|||
.withPropertyValues("spring.webservices.wsdl-locations=classpath:/wsdl")
|
||||
.run((context) -> {
|
||||
assertThat(context.getBeansOfType(SimpleWsdl11Definition.class))
|
||||
.hasSize(1).containsKey("service");
|
||||
assertThat(context.getBeansOfType(SimpleXsdSchema.class)).hasSize(1)
|
||||
.containsKey("types");
|
||||
.containsOnlyKeys("service");
|
||||
assertThat(context.getBeansOfType(SimpleXsdSchema.class))
|
||||
.containsOnlyKeys("types");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +112,9 @@ public class WebServicesAutoConfigurationTests {
|
|||
"spring.webservices.wsdl-locations[0]=classpath:/wsdl")
|
||||
.run((context) -> {
|
||||
assertThat(context.getBeansOfType(SimpleWsdl11Definition.class))
|
||||
.hasSize(1).containsKey("service");
|
||||
assertThat(context.getBeansOfType(SimpleXsdSchema.class)).hasSize(1)
|
||||
.containsKey("types");
|
||||
.containsOnlyKeys("service");
|
||||
assertThat(context.getBeansOfType(SimpleXsdSchema.class))
|
||||
.containsOnlyKeys("types");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ content into your application. Rather, pick only the properties that you need.
|
|||
server.address= # Network address to which the server should bind.
|
||||
server.compression.enabled=false # Whether response compression is enabled.
|
||||
server.compression.excluded-user-agents= # List of user-agents to exclude from compression.
|
||||
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript # Comma-separated list of MIME types that should be compressed.
|
||||
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml # Comma-separated list of MIME types that should be compressed.
|
||||
server.compression.min-response-size=2048 # Minimum "Content-Length" value that is required for compression to be performed.
|
||||
server.connection-timeout= # Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout.
|
||||
server.error.include-exception=false # Include the "exception" attribute.
|
||||
|
|
@ -328,7 +328,7 @@ content into your application. Rather, pick only the properties that you need.
|
|||
# SPRING HATEOAS ({sc-spring-boot-autoconfigure}/hateoas/HateoasProperties.{sc-ext}[HateoasProperties])
|
||||
spring.hateoas.use-hal-as-default-json-media-type=true # Whether application/hal+json responses should be sent to requests that accept application/json.
|
||||
|
||||
# HTTP ({sc-spring-boot-autoconfigure}/http/HttpEncodingProperties.{sc-ext}[HttpProperties])
|
||||
# HTTP ({sc-spring-boot-autoconfigure}/http/HttpProperties.{sc-ext}[HttpProperties])
|
||||
spring.http.converters.preferred-json-mapper= # Preferred JSON mapper to use for HTTP message conversion. By default, auto-detected according to the environment.
|
||||
spring.http.encoding.charset=UTF-8 # Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly.
|
||||
spring.http.encoding.enabled=true # Whether to enable http encoding support.
|
||||
|
|
|
|||
|
|
@ -5734,7 +5734,7 @@ container factory. Similarly, if a `RecordMessageConverter`, `ErrorHandler` or
|
|||
factory.
|
||||
|
||||
TIP: A custom `ChainedKafkaTransactionManager` must be marked `@Primary` as it usually
|
||||
reference the auto-configured `KafkaTransactionManager` bean.
|
||||
references the auto-configured `KafkaTransactionManager` bean.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ public class SpringApplicationJsonEnvironmentPostProcessorTests {
|
|||
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment,
|
||||
"spring.application.json=foo:bar");
|
||||
this.processor.postProcessEnvironment(this.environment, null);
|
||||
assertThat(this.environment.resolvePlaceholders("${foo:}")).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue