@ConditionalOnMissingBean(name = "ticketRegistryCleanerScheduler")
    @ConditionalOnMatchingHostname(name = "cas.ticket.registry.cleaner.schedule.enabled-on-host")
    @Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @Lazy(false)
    public Runnable ticketRegistryCleanerScheduler(
        final ConfigurableApplicationContext applicationContext,
        @Qualifier(TicketRegistryCleaner.BEAN_NAME) final TicketRegistryCleaner ticketRegistryCleaner) {
        return BeanSupplier.of(Runnable.class)
            .when(BeanCondition.on("cas.ticket.registry.cleaner.schedule.enabled").isTrue()
                .evenIfMissing().given(applicationContext.getEnvironment()))
            .supply(() -> {
                LOGGER.debug("Ticket registry cleaner is enabled to run on schedule.");
                return new TicketRegistryCleanerScheduler(ticketRegistryCleaner);
            })
            .otherwiseProxy(__ -> LOGGER.info("Ticket registry cleaner is not enabled to run on schedule. "
                + "Expired tickets are not forcefully cleaned by CAS. It is up to the ticket registry itself to "
                + "clean up tickets based on its own expiration and eviction policies."))
            .get();
    }
This is {@link CasCoreTicketsSchedulingConfiguration}.

@author Misagh Moayyed
@since 5.1.0
core/cas-server-core-tickets/src/main/java/org/apereo/cas/config/CasCoreTicketsSchedulingConfiguration.java