Spring websocket 带有stomp和spring会话的spring消息xml配置
我正在尝试使用stomp设置WebSocket和spring消息传递,并在spring会话中使用redis支持的会话。我们的应用程序上下文是通过xml连接的,spring会话正在处理应用程序的非websocket部分。websocket的相关配置如下所示Spring websocket 带有stomp和spring会话的spring消息xml配置,spring-websocket,spring-messaging,spring-session,Spring Websocket,Spring Messaging,Spring Session,我正在尝试使用stomp设置WebSocket和spring消息传递,并在spring会话中使用redis支持的会话。我们的应用程序上下文是通过xml连接的,spring会话正在处理应用程序的非websocket部分。websocket的相关配置如下所示 <websocket:message-broker application-destination-prefix="/streaming" > <websocket:stomp-endpoint path="/
<websocket:message-broker application-destination-prefix="/streaming" >
<websocket:stomp-endpoint path="/data">
<websocket:sockjs session-cookie-needed="false" />
</websocket:stomp-endpoint>
<websocket:stomp-broker-relay prefix="/topic" relay-host="${jms_hostname}" relay-port="${jms_stomp_port}" />
<websocket:client-inbound-channel>
<websocket:interceptors>
<ref bean="sessionRepoMessageInterceptor"/>
<ref bean="authenticationValidationInterceptor" />
<ref bean="selectorValidationInterceptor" />
<ref bean="selectorQuotingInterceptor" /> <!-- comes after we have validated the selector, we now shim it so JMS understands it -->
</websocket:interceptors>
</websocket:client-inbound-channel>
</websocket:message-broker>
我在这里定义了spring会话与web套接字集成所需的bean:
<bean id="redisSessionBackedWebsocketHandler" class="org.springframework.session.web.socket.server.">
</bean>
<bean id="sessionRepoMessageInterceptor" class="org.springframework.session.web.socket.server.SessionRepositoryMessageInterceptor">
</bean>
<bean id="webSocketRegistryListener" class="org.springframework.session.web.socket.handler.WebSocketRegistryListener">
</bean>
但我不确定在哪里可以将它们连接到web套接字配置,也无法找到任何关于如何以这种方式进行连接的文档
想法?仅包含Java和注释变体的配置
根据Spring会话,AbstractSessionWebSocketMessageBrokerConfigure
完成了Spring会话和Spring WebSockets之间的无缝集成。然而,我们可以看到一些段落,它的作用是:
为了支持Spring会话,我们需要确保
老实说,从XML配置这些东西并不容易
请随意关注这个问题:是的,我尝试通过XML将其连接到一起,但中途遇到了麻烦。看看您提出的问题,我可以看到一个解决方案,它将使用rwinch建议的混合注释和XML配置让我们同时启动并运行。谢谢