Added ConditionalOnProperty for batch event listeners
Resolves spring-cloud/spring-cloud-task#130
This commit is contained in:
@@ -82,17 +82,20 @@ public class BatchEventAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@Lazy
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.job.execution.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public JobExecutionListener jobExecutionEventsListener() {
|
||||
return new EventEmittingJobExecutionListener(listenerChannels.jobExecutionEvents());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.step.execution.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public StepExecutionListener stepExecutionEventsListener() {
|
||||
return new EventEmittingStepExecutionListener(listenerChannels.stepExecutionEvents());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Lazy
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.chunk.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public GatewayProxyFactoryBean chunkEventsListener() {
|
||||
GatewayProxyFactoryBean factoryBean =
|
||||
new GatewayProxyFactoryBean(ChunkListener.class);
|
||||
@@ -103,21 +106,25 @@ public class BatchEventAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.read.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public ItemReadListener itemReadEventsListener() {
|
||||
return new EventEmittingItemReadListener(listenerChannels.itemReadEvents());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.write.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public ItemWriteListener itemWriteEventsListener() {
|
||||
return new EventEmittingItemWriteListener(listenerChannels.itemWriteEvents());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.process.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public ItemProcessListener itemProcessEventsListener() {
|
||||
return new EventEmittingItemProcessListener(listenerChannels.itemProcessEvents());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.task.events.skip.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public SkipListener skipEventsListener() {
|
||||
return new EventEmittingSkipListener(listenerChannels.skipEvents());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user