class RegisterDefaultTaskSchedulerPostProcessor
        implements BeanDefinitionRegistryPostProcessor, Ordered, BeanFactoryAware {
    private BeanFactory beanFactory;

    private static final Logger logger = LoggerFactory.getLogger(RegisterDefaultTaskSchedulerPostProcessor.class);

    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {<FILL_FUNCTION_BODY>}

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {}

    @Override
    public int getOrder() {
        return Ordered.LOWEST_PRECEDENCE;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }
}

        ListableBeanFactory listableBeanFactory = (ListableBeanFactory) this.beanFactory;
        if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(listableBeanFactory, TaskScheduler.class).length == 0) {
            String[] scheduledExecutorsBeanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
                    listableBeanFactory, ScheduledExecutorService.class);
            if (scheduledExecutorsBeanNames.length != 1) {
                logger.debug("Registering default TaskScheduler");
                registry.registerBeanDefinition(
                        DEFAULT_TASK_SCHEDULER_BEAN_NAME,
                        rootBeanDefinition(ConcurrentTaskScheduler.class).getBeanDefinition());
                if (scheduledExecutorsBeanNames.length != 0) {
                    logger.warn("Multiple ScheduledExecutorService found, do not know which one to use.");
                }
            } else {
                logger.debug(
                        "Registering default TaskScheduler with existing ScheduledExecutorService {}",
                        scheduledExecutorsBeanNames[0]);
                registry.registerBeanDefinition(
                        DEFAULT_TASK_SCHEDULER_BEAN_NAME,
                        rootBeanDefinition(ConcurrentTaskScheduler.class)
                                .addPropertyReference("scheduledExecutor", scheduledExecutorsBeanNames[0])
                                .getBeanDefinition());
            }
        }
    
<no_super_class>