Polish
This commit is contained in:
@@ -72,10 +72,8 @@ public class CodecsAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public CodecCustomizer loggingCodecCustomizer(InsightsProperties properties) {
|
||||
return (configurer) -> {
|
||||
configurer.defaultCodecs().enableLoggingRequestDetails(
|
||||
properties.getWeb().isLogRequestDetails());
|
||||
};
|
||||
return (configurer) -> configurer.defaultCodecs().enableLoggingRequestDetails(
|
||||
properties.getWeb().isLogRequestDetails());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,15 +56,12 @@ class KafkaStreamsAnnotationDrivenConfiguration {
|
||||
Map<String, Object> streamsProperties = this.properties.buildStreamsProperties();
|
||||
if (this.properties.getStreams().getApplicationId() == null) {
|
||||
String applicationName = environment.getProperty("spring.application.name");
|
||||
if (applicationName != null) {
|
||||
streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG,
|
||||
applicationName);
|
||||
}
|
||||
else {
|
||||
if (applicationName == null) {
|
||||
throw new InvalidConfigurationPropertyValueException(
|
||||
"spring.kafka.streams.application-id", null,
|
||||
"This property is mandatory and fallback 'spring.application.name' is not set either.");
|
||||
}
|
||||
streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationName);
|
||||
}
|
||||
return new KafkaStreamsConfiguration(streamsProperties);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.boot.autoconfigure.task;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -66,14 +65,16 @@ public class TaskExecutionAutoConfiguration {
|
||||
@ConditionalOnMissingBean
|
||||
public TaskExecutorBuilder taskExecutorBuilder() {
|
||||
TaskExecutionProperties.Pool pool = this.properties.getPool();
|
||||
return new TaskExecutorBuilder().queueCapacity(pool.getQueueCapacity())
|
||||
.corePoolSize(pool.getCoreSize()).maxPoolSize(pool.getMaxSize())
|
||||
.allowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout())
|
||||
.keepAlive(pool.getKeepAlive())
|
||||
.threadNamePrefix(this.properties.getThreadNamePrefix())
|
||||
.customizers(this.taskExecutorCustomizers.stream()
|
||||
.collect(Collectors.toList()))
|
||||
.taskDecorator(this.taskDecorator.getIfUnique());
|
||||
TaskExecutorBuilder builder = new TaskExecutorBuilder();
|
||||
builder = builder.queueCapacity(pool.getQueueCapacity());
|
||||
builder = builder.corePoolSize(pool.getCoreSize());
|
||||
builder = builder.maxPoolSize(pool.getMaxSize());
|
||||
builder = builder.allowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout());
|
||||
builder = builder.keepAlive(pool.getKeepAlive());
|
||||
builder = builder.threadNamePrefix(this.properties.getThreadNamePrefix());
|
||||
builder = builder.customizers(this.taskExecutorCustomizers);
|
||||
builder = builder.taskDecorator(this.taskDecorator.getIfUnique());
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Bean(name = APPLICATION_TASK_EXECUTOR_BEAN_NAME)
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.task;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@@ -55,9 +53,11 @@ public class TaskSchedulingAutoConfiguration {
|
||||
@ConditionalOnMissingBean
|
||||
public TaskSchedulerBuilder taskSchedulerBuilder(TaskSchedulingProperties properties,
|
||||
ObjectProvider<TaskSchedulerCustomizer> taskSchedulerCustomizers) {
|
||||
return new TaskSchedulerBuilder().poolSize(properties.getPool().getSize())
|
||||
.threadNamePrefix(properties.getThreadNamePrefix()).customizers(
|
||||
taskSchedulerCustomizers.stream().collect(Collectors.toList()));
|
||||
TaskSchedulerBuilder builder = new TaskSchedulerBuilder();
|
||||
builder = builder.poolSize(properties.getPool().getSize());
|
||||
builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
|
||||
builder = builder.customizers(taskSchedulerCustomizers);
|
||||
return builder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user