缺少 spring websocket 范围 [英] spring websocket scope missing

查看:41
本文介绍了缺少 spring websocket 范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在组件中使用新的websocket"范围时,我得到:

when i use the new "websocket" scope in a component, i get:

java.lang.IllegalStateException: No Scope registered for scope name 'websocket'

控制器:

@RestController
@Scope(value = "websocket", proxyMode = ScopedProxyMode.TARGET_CLASS)
@Slf4j
public class GenericWrapperController extends TextWebSocketHandler {

spring 版本 4.3.3.RELEASE 和 1.4.1.RELEASE 用于 springboot.我猜它的版本相关但是文档说这个范围已经在 4.1 中引入了.

spring version 4.3.3.RELEASE and 1.4.1.RELEASE for springboot. my guess its version related however the docs say this scope was introduced in 4.1 already.

推荐答案

annotation@EnableWebSocketMessageBroker需要在配置类中启用 websocket 范围.@EnableWebSocket 不够用

annotation @EnableWebSocketMessageBroker is required in a configuration class to enable the websocket scope. @EnableWebSocket is NOT suffcicient

这篇关于缺少 spring websocket 范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆