Add PropertyMapper.from(value)
See gh-13837
This commit is contained in:
committed by
Stephane Nicoll
parent
dd9209c7d9
commit
1bd52bc432
@@ -122,7 +122,7 @@ public class BasicBatchConfigurer implements BatchConfigurer {
|
||||
protected JobRepository createJobRepository() throws Exception {
|
||||
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
|
||||
PropertyMapper map = PropertyMapper.get();
|
||||
map.from(() -> this.dataSource).to(factory::setDataSource);
|
||||
map.from(this.dataSource).to(factory::setDataSource);
|
||||
map.from(this::determineIsolationLevel).whenNonNull()
|
||||
.to(factory::setIsolationLevelForCreate);
|
||||
map.from(this.properties::getTablePrefix).whenHasText()
|
||||
|
||||
@@ -85,9 +85,8 @@ public class ConcurrentKafkaListenerContainerFactoryConfigurer {
|
||||
PropertyMapper map = PropertyMapper.get();
|
||||
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(this.messageConverter).whenNonNull().to(factory::setMessageConverter);
|
||||
map.from(this.replyTemplate).whenNonNull().to(factory::setReplyTemplate);
|
||||
map.from(properties::getType).whenEqualTo(Listener.Type.BATCH)
|
||||
.toCall(() -> factory.setBatchListener(true));
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TomcatWebServerFactoryCustomizer implements
|
||||
tomcatProperties.getMaxThreads()));
|
||||
propertyMapper.from(tomcatProperties::getMinSpareThreads).when(this::isPositive)
|
||||
.to((minSpareThreads) -> customizeMinThreads(factory, minSpareThreads));
|
||||
propertyMapper.from(() -> determineMaxHttpHeaderSize()).when(this::isPositive)
|
||||
propertyMapper.from(this::determineMaxHttpHeaderSize).when(this::isPositive)
|
||||
.to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory,
|
||||
maxHttpHeaderSize));
|
||||
propertyMapper.from(tomcatProperties::getMaxSwallowSize).whenNonNull()
|
||||
|
||||
@@ -81,7 +81,7 @@ public class UndertowWebServerFactoryCustomizer implements
|
||||
.to(factory::setAccessLogSuffix);
|
||||
propertyMapper.from(accesslogProperties::isRotate)
|
||||
.to(factory::setAccessLogRotate);
|
||||
propertyMapper.from(() -> getOrDeduceUseForwardHeaders())
|
||||
propertyMapper.from(this::getOrDeduceUseForwardHeaders)
|
||||
.to(factory::setUseForwardHeaders);
|
||||
propertyMapper.from(properties::getMaxHttpHeaderSize).when(this::isPositive)
|
||||
.to((maxHttpHeaderSize) -> customizeMaxHttpHeaderSize(factory,
|
||||
|
||||
@@ -138,10 +138,10 @@ public class MultipartProperties {
|
||||
public MultipartConfigElement createMultipartConfig() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
map.from(() -> this.fileSizeThreshold).to(factory::setFileSizeThreshold);
|
||||
map.from(() -> this.location).whenHasText().to(factory::setLocation);
|
||||
map.from(() -> this.maxRequestSize).to(factory::setMaxRequestSize);
|
||||
map.from(() -> this.maxFileSize).to(factory::setMaxFileSize);
|
||||
map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);
|
||||
map.from(this.location).whenHasText().to(factory::setLocation);
|
||||
map.from(this.maxRequestSize).to(factory::setMaxRequestSize);
|
||||
map.from(this.maxFileSize).to(factory::setMaxFileSize);
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user