SSM WebSocket项目搭建

本文介绍了如何在IDEA环境下,使用SpringMvc、Spring、Mybatis和WebSocket搭建项目。详细步骤包括配置Maven,设置Spring的bean和扫描包,实现WebSocket的配置和拦截器,以及创建处理请求的类。在完成配置后,通过特定的在线测试工具验证WebSocket的连接,并强调了WebSocket连接地址与Session登录地址一致的重要性。
摘要由CSDN通过智能技术生成

SpringMvc+Spring+Mybatis +Websocket

关于开发环境 我使用的是IDEA15.0.6 JDK1.7 

首先关于项目搭建 我们需要使用配置好Maven项目Pom.xml引入Jar包

<!-- start websocket -->
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
</dependency>
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-messaging</artifactId>
  <version>4.0.5.RELEASE</version>
</dependency>
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-websocket</artifactId>
  <version>4.0.5.RELEASE</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>2.3.0</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.3.1</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.3.3</version>
</dependency>
<!-- end websocket -->

接着我们需要在Spring的applicationContext.xml配置包扫描

<context:component-scan base-package="com.**" 
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值