Skip to content

StompSubProtocolHandler eventPublisher being cleared by SubProtocolWebSocketHandler [SPR-11825] #16444

@spring-projects-issues

Description

@spring-projects-issues

Jeffrey Barrus opened SPR-11825 and commented

I am trying to subscribe to SessionConnectEvent but found that it is never published. After stepping through code, I found that the StompSubProtocolHandler ends up with null for eventPublisher after context initialization. It looks like when SubProtoocolWebSocketHandler is initialized, setProtocolHandlers is called before setApplicationEventPublisher. This results in the StompSubProtocolHandler getting its eventPublisher set to null.

See line 137 in SubProtocolWebSocketHandler.java

if (handler instanceof ApplicationEventPublisherAware) {
     ((ApplicationEventPublisherAware) handler).setApplicationEventPublisher(this.eventPublisher);
}

Affects: 4.0.5

Referenced from: commits e9ecaf6, 0dddb6f

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions