解决:javax.websocket.server.ServerContainer not available 报错问题

原因:

用于扫描带有 @ServerEndpoint 的注解成为 websocket,该方法是 服务器端点出口,当进行 SpringBoot 单元测试时,并没有启动服务器,所以当加载到这个bean时会报错。

解决方法:

加上这个注解内容

复制代码
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)

运行通过,不白嫖

相关推荐
万象.34 分钟前
Linux数据链路层通信原理及报文格式
linux·网络·网络协议
victory04314 小时前
Agent 面试知识树 + 高频追问答案库
网络·面试·职场和发展
2501_921649494 小时前
美股历史 K线数据 API接口综合评测与接入指南
后端·python·websocket·金融·restful
Blurpath住宅代理5 小时前
原生IP vs 广播IP:如何从网络层判断代理IP的“真实性”?
网络·静态ip·动态ip·代理·代理ip·住宅ip·住宅代理
chinesegf6 小时前
DNS 验证验证SSL证书
linux·服务器·网络
猿饵块6 小时前
python--websocket
网络·websocket·网络协议
taxunjishu6 小时前
塔讯总线协议转换信捷 PLC 对接 TCP/IP 设备实战方案
网络·物联网·自动化
墨神谕7 小时前
什么是Socket
websocket·网络协议
带娃的IT创业者7 小时前
WeClaw WebSocket 连接中断诊断:从频繁掉线到稳定长连的优化之路
python·websocket·网络协议·php·fastapi·实时通信
IpdataCloud7 小时前
指纹浏览器为什么要自建IP检测?基于IP数据云离线库的架构实践
数据库·网络协议·tcp/ip·架构·edge浏览器