spring-websocket.xml 1.2 KB

12345678910111213141516171819202122232425
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:websocket="http://www.springframework.org/schema/websocket"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/mvc
  9. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  10. http://www.springframework.org/schema/websocket
  11. http://www.springframework.org/schema/websocket/spring-websocket.xsd">
  12. <!--配置 webSocket-->
  13. <bean id="systemWebSocketHandler" class="com.goafanti.core.websocket.SystemWebSocketHandler" scope="singleton"></bean>
  14. <websocket:handlers allowed-origins="*">
  15. <!--指定 webSocket 地址-->
  16. <websocket:mapping path="/webSocketServer" handler="systemWebSocketHandler"/>
  17. <!-- 过滤器 -->
  18. <websocket:handshake-interceptors>
  19. <bean class="com.goafanti.core.websocket.WebSocketHandshakeInterceptor"/>
  20. </websocket:handshake-interceptors>
  21. </websocket:handlers>
  22. </beans>