Spring Boot——AbstractWebSocketMessageBrokerConfigurer已过时解决方案

问题描述

Spring Boot2.0及以上版本,编译器显示AbstractWebSocketMessageBrokerConfigurer已过时。

官方文档

https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/web.html#websocket-server 

解决方案

实现WebSocketMessageBrokerConfigurer接口

import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;

/**
 * @Author ShenTuZhiGang
 * @Version 1.0.0
 * @Date 2020-04-12 13:10
 */
@Configuration
@EnableWebSocketMessageBroker
public class CustomWebSocketConfig implements WebSocketMessageBrokerConfigurer {
}

 

参考文章

https://bbs.csdn.net/topics/392417235

https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/web.html#websocket-server

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 1024 设计师:白松林 返回首页