Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ private void registerEnableWebSocketIfNecessary(BeanDefinitionRegistry registry)

BeanDefinitionReaderUtils.registerWithGeneratedName(
new RootBeanDefinition(IntegrationDynamicWebSocketHandlerMapping.class,
IntegrationDynamicWebSocketHandlerMapping::new),
() -> {
IntegrationDynamicWebSocketHandlerMapping dynamicWebSocketHandlerMapping =
new IntegrationDynamicWebSocketHandlerMapping();
dynamicWebSocketHandlerMapping.setOrder(0);
return dynamicWebSocketHandlerMapping;
}),
registry);

BeanDefinitionBuilder enableWebSocketBuilder =
Expand Down
4 changes: 3 additions & 1 deletion src/reference/asciidoc/web-sockets.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,6 @@ dynamicServerFlow.destroy();
====

NOTE: It is important to call `.addBean(serverWebSocketContainer)` on the dynamic flow registration to add the instance of `ServerWebSocketContainer` into an `ApplicationContext` for endpoint registration.
When a dynamic flow registration is destroyed, the associated `ServerWebSocketContainer` instance is destroyed, too, as well as the respective endpoint registration, including URL path mappings.
When a dynamic flow registration is destroyed, the associated `ServerWebSocketContainer` instance is destroyed, too, as well as the respective endpoint registration, including URL path mappings.

IMPORTANT: The dynamic Websocket endpoints can only be registered via Spring Integration mechanism: when regular Spring `@EnableWebsocket` is used, Spring Integration configuration backs off and no infrastructure for dynamic endpoints is registered.