diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java index f8d51b2c5df..c50af9ea47a 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java @@ -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 = diff --git a/src/reference/asciidoc/web-sockets.adoc b/src/reference/asciidoc/web-sockets.adoc index 77369da48f8..ce7509e1f49 100644 --- a/src/reference/asciidoc/web-sockets.adoc +++ b/src/reference/asciidoc/web-sockets.adoc @@ -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. \ No newline at end of file +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. \ No newline at end of file