见图。JobSchedulerManager中是有自动注入configStore的。
但是ConfigClient只是一个@FeignClient的接口。他是怎么跟jobSchedulerManger循环起来的?
相关代码如下:
JobSchedulerManager.java
@Component
public class JobSchedulerManager implements ApplicationListener {
@Autowired
private Scheduler scheduler;
@Autowired
private ConfigStore configStore;
@Autowired
private ApplicationContext appCtx;
private Map<String, Class<? extends Job>> jobClassRegistry = new HashMap<>();
@PostConstruct
public void init() {
jobClassRegistry.put(PromDiffAgmExecuteJob.NAME, PromDiffAgmExecuteJob.class);
jobClassRegistry.put(ItemDiffAgmExecuteJob.NAME, ItemDiffAgmExecuteJob.class);
jobClassRegistry.put(VoucherPromDiffAgmExecuteJob.NAME, VoucherPromDiffAgmExecuteJob.class);
jobClassRegistry.put(AbroadCombPrcProcessJob.NAME, AbroadCombPrcProcessJob.class);
jobClassRegistry.put(PromPriceCalcJob.NAME, PromPriceCalcJob.class);
jobClassRegistry.put(SpmsTransferJob.NAME, SpmsTransferJob.class);
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ApplicationReadyEvent) {
if (((ApplicationReadyEvent) event).getApplicationContext().equals(appCtx)) {
jobScheduler();
}
}
}
}
ConfigClient.java
@FeignClient(name = "baas-config", configuration = AuthConfiguration.class)
public interface ConfigClient extends ConfigApi {
}