当前位置: 首页 > news >正文

Websocket(1)pom引入、嵌入spring

1、引入pom文件

     <!-- https://mvnrepository.com/artifact/org.springframework/spring-websocket -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-websocket</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-messaging -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-messaging</artifactId>
            <version>${springframework.version}</version>
        </dependency>

2、嵌入spring

<beans 
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:websocket="http://www.springframework.org/schema/websocket"
    xsi:schemaLocation="
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-4.0.xsd 
            http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
            http://www.springframework.org/schema/websocket
            http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd
            ">
            <!-- websocket处理类 -->
            <bean id="myHandler" class="com.aptech.business.remote.websocket.web.MyWebSocketHandler"/>
            <!-- 握手接口/拦截器 -->
            <bean id="myInterceptor" class="com.aptech.business.remote.websocket.web.HandshakeInterceptor"/>
 
            <websocket:handlers>
                <websocket:mapping path="/websocket" handler="myHandler"/>
                <websocket:handshake-interceptors >
                    <ref bean="myInterceptor"/>
                </websocket:handshake-interceptors>
            </websocket:handlers>

</beans>

 

转载于:https://www.cnblogs.com/minihouseCoder/p/9428538.html

相关文章:

  • Docker 操作记录
  • CentOS7安装GO
  • dll和lib的关系(转)
  • Quest 公司的Shareplex 与 GoldenGate比较
  • WPF程序 双击exe自动申请“以管理员方式运行”权限
  • 块设备
  • CCPC-Wannafly Camp #4(部分解题报告)
  • HDU 6370(并查集)
  • 面试题16:数值的整数次方
  • 开启写博客之旅
  • 网址搜集
  • 面试题小结01---实现将IP地址转换成一个整数
  • 星际争霸修改教程
  • K-Means 实现图像分割
  • BZOJ5293: [Bjoi2018]求和
  • android 一些 utils
  • Android开发 - 掌握ConstraintLayout(四)创建基本约束
  • Cumulo 的 ClojureScript 模块已经成型
  • Flannel解读
  • JavaScript 无符号位移运算符 三个大于号 的使用方法
  • MySQL Access denied for user 'root'@'localhost' 解决方法
  • react-native 安卓真机环境搭建
  • React系列之 Redux 架构模式
  • Spring核心 Bean的高级装配
  • SQLServer之索引简介
  • 分布式事物理论与实践
  • 基于OpenResty的Lua Web框架lor0.0.2预览版发布
  • 它承受着该等级不该有的简单, leetcode 564 寻找最近的回文数
  • 探索 JS 中的模块化
  • ​ 全球云科技基础设施:亚马逊云科技的海外服务器网络如何演进
  • # Panda3d 碰撞检测系统介绍
  • # 达梦数据库知识点
  • #android不同版本废弃api,新api。
  • $().each和$.each的区别
  • $.ajax()方法详解
  • $emit传递多个参数_PPC和MIPS指令集下二进制代码中函数参数个数的识别方法
  • (带教程)商业版SEO关键词按天计费系统:关键词排名优化、代理服务、手机自适应及搭建教程
  • (剑指Offer)面试题34:丑数
  • (译) 理解 Elixir 中的宏 Macro, 第四部分:深入化
  • (转) ns2/nam与nam实现相关的文件
  • * CIL library *(* CIL module *) : error LNK2005: _DllMain@12 already defined in mfcs120u.lib(dllmodu
  • . Flume面试题
  • .net core IResultFilter 的 OnResultExecuted和OnResultExecuting的区别
  • .NET core 自定义过滤器 Filter 实现webapi RestFul 统一接口数据返回格式
  • .NET Core、DNX、DNU、DNVM、MVC6学习资料
  • .net mvc actionresult 返回字符串_.NET架构师知识普及
  • .NET Standard / dotnet-core / net472 —— .NET 究竟应该如何大小写?
  • .NET 将混合了多个不同平台(Windows Mac Linux)的文件 目录的路径格式化成同一个平台下的路径
  • .NET/C# 项目如何优雅地设置条件编译符号?
  • .net安装_还在用第三方安装.NET?Win10自带.NET3.5安装
  • .net下简单快捷的数值高低位切换
  • .Net中wcf服务生成及调用
  • .net中我喜欢的两种验证码
  • @NestedConfigurationProperty 注解用法
  • [ IO.File ] FileSystemWatcher