ScheduledAnnotationBeanPostProcessor::postProcessBeforeDestruction is not invoked if tracing is present
A refresh scoped bean with Scheduled annotation does not cancel current scheduled task upon refresh when tracing libraries are present in the classpath (could be sleuth or opentracing-jaeger).
A sample application is given here https://github.com/winster/SpringSchedulerDynamic
Please note that it works as expected if tracing is not there. (A new scheduled task is created and current one is canceled)
Adding some information on debug starting from RefreshScope::refreshAll
1. Without tracing library
RefreshScope::refreshAll -> GenericScope::destroy -> DisposableBeanAdapater::run -> DisposableBeanAdapater::destroy
this.beanPostProcessors = ScheduledAnnotationBeanPostProcessor, ApplicationListenerDetector
2. With tracing library
RefreshScope::refreshAll -> GenericScope::destroy -> DisposableBeanAdapater::run -> DisposableBeanAdapater::destroy
this.beanPostProcessors = ApplicationListenerDetector
It is noted that ScheduledAnnotationBeanPostProcessor::postProcessBeforeDestruction is not invoked in this case
And if opentracing.spring.cloud.scheduled.enabled is set as false, it works as expected