Description
Summary
Spring Security provides a DelegatingSecurityContextRunnable
abstraction for Runnable
that can be used for async and scheduled tasks. The primary contract for task scheduling is TaskScheduler
and there's no such wrapper available at the moment.
Actual Behavior
Users are configuring a DelegatingSecurityContextScheduledExecutorService
for support of @EnableScheduling
which is not the primary contract that @EnableScheduling
expects.
Expected Behavior
Spring Security provides a TaskScheduler
variant or the documentation routes users to expose a TaskScheduler
bean rather than exposing a ScheduledExecutorService
bean.
This relates to spring-projects/spring-boot#15032 - Spring Framework considers ScheduledExecutorService
as a fallback of the primary TaskScheduler
API. It would be nice if Spring Security aligns to that, either in code or in guiding users in the documentation.