类org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor源码实例Demo

下面列出了怎么用org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: kayenta   文件: PipelineController.java
@Autowired
public PipelineController(
    ExecutionLauncher executionLauncher,
    ExecutionRepository executionRepository,
    ObjectMapper kayentaObjectMapper,
    ConfigurableApplicationContext context,
    HealthIndicatorRegistry healthIndicators,
    HealthAggregator healthAggregator,
    ScheduledAnnotationBeanPostProcessor postProcessor) {
  this.executionLauncher = executionLauncher;
  this.executionRepository = executionRepository;
  this.kayentaObjectMapper = kayentaObjectMapper;
  this.context = context;
  this.healthIndicator = new CompositeHealthIndicator(healthAggregator, healthIndicators);
  this.postProcessor = postProcessor;
}
 
@Test
public void shouldRegisterSchedulerPostProcessor() {

    // when
    ScheduledAnnotationBeanPostProcessor bean =
            applicationContext.getBean(ScheduledAnnotationBeanPostProcessor.class);

    // then
    assertNotNull(bean);
}
 
@Test
public void stopJobSchedulerWhenSchedulerDestroyed() throws Exception {
    ScheduledAnnotationBeanPostProcessor bean = context.getBean(ScheduledAnnotationBeanPostProcessor.class);
    SpringBatchScheduler schedulerBean = context.getBean(SpringBatchScheduler.class);
    await().untilAsserted(() -> Assert.assertEquals(2, schedulerBean.getBatchRunCounter()
        .get()));
    bean.postProcessBeforeDestruction(schedulerBean, "SpringBatchScheduler");
    await().atLeast(3, SECONDS);

    Assert.assertEquals(2, schedulerBean.getBatchRunCounter()
        .get());
}
 
源代码4 项目: jfilter   文件: FileWatcherITest.java
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Autowired
public void setTaskScheduler(ScheduledAnnotationBeanPostProcessor taskScheduler) {
    this.taskScheduler = taskScheduler;
}