Spring Boot 支持 WebSocket 通信功能
发布时间
阅读量:
阅读量
操作流程:
1.导入WebSocket坐标。
在pom.xml文件中添加相应的依赖配置:
**spring-boot-starter-websocket**
2.编写WebSocket配置类,用于注册WebSocket的Bean。
package com.rc114.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/** * WebSocket配置类,用于注册WebSocket的Bean
* @author Administrator
*/
@Configuration
public class WebSocketConfiguration {
@Bean
public ServerE
全部评论 (0)
还没有任何评论哟~
