spring开启定时任务,需要注解EnableScheduling
Import注解中,有SchedulingConfiguration
这个SchedulingConfiguration,会创建beanPostProcessor–ScheduledAnnotationBeanPostProcessor
在bean创建过程中回调beanPostProcessor时,ScheduledAnnotationBeanPostProcessor会执行postProcessAfterInitialization方法,扫描每个bean中存在的方法
将任务根据cron、fixRate、fixDelay封装为对应的CronTask、FixedRateTask、FixedDelayTask,并注册到scheduledregistrar中