spring-batch BatchMetricsApplication 源码
spring-batch BatchMetricsApplication 代码
文件路径:/spring-batch-samples/src/main/java/org/springframework/batch/sample/metrics/BatchMetricsApplication.java
package org.springframework.batch.sample.metrics;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@EnableScheduling
@EnableBatchProcessing
@Import({ Job1Configuration.class, Job2Configuration.class, JobScheduler.class, PrometheusConfiguration.class })
@PropertySource("metrics-sample.properties")
public class BatchMetricsApplication {
public static void main(String[] args) {
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
BatchMetricsApplication.class);
applicationContext.start();
}
@Bean(destroyMethod = "shutdown")
public ThreadPoolTaskScheduler taskScheduler(@Value("${thread.pool.size}") int threadPoolSize) {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(threadPoolSize);
return threadPoolTaskScheduler;
}
}
相关信息
相关文章
spring-batch Job1Configuration 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦