Skip to content

EnableWebSocket registers a non functional task scheduler to the context [SPR-16705] #21246

@spring-projects-issues

Description

@spring-projects-issues

Stéphane Nicoll opened SPR-16705 and commented

@EnableWebSocket may register a defaultSockJsTaskScheduler bean that could fallback to NoOpScheduler is no task scheduling is required (sic).

This conflicts with the default behaviour of @EnableScheduling. By default, it will look up for the unique presence of a TaskScheduler and, if one is found, it will use it.

Unfortunately, as soon as those two are in combinations (and @EnableWebSocket runs before @EnableScheduling), it breaks any app as a scheduling task is attempting to register itself to a no op scheduler.

The latter case is unfortunately quite common with Spring Boot as some auto-configurations (i.e. Spring Session Redis) rely on @EnableScheduling and users have @EnableWebSocket on their app to signal they want to use that feature.


Affects: 5.0.5

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions