集成Shiro和WebSocket接口时遇到问题

集成Shiro和WebSocket接口时遇到问题,websocket,shiro,Websocket,Shiro,正如标题中所述,当我在Shiro管理的Springboot项目中开发WebSocket时,我需要在socket接口中获取当前登录用户的信息 public static Subject getSubjct() { return SecurityUtils.getSubject(); } 此行出错:SecurityUtils.getSubject() org.apache.shiro.unavailableSecurityManager异常:调用代码无法访问SecurityManager,

正如标题中所述,当我在Shiro管理的Springboot项目中开发WebSocket时,我需要在socket接口中获取当前登录用户的信息

public static Subject getSubjct() {
    return SecurityUtils.getSubject();
}
此行出错:SecurityUtils.getSubject()

org.apache.shiro.unavailableSecurityManager异常:调用代码无法访问SecurityManager,或者绑定到org.apache.shiro.util.ThreadContext,或者作为vm静态单例。这是无效的应用程序配置。
位于org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)
位于org.apache.shiro.subject.subject$Builder。(subject.java:626)
位于org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)
在com.runtime.system.util.ShiroUtils.getSubject上(ShiroUtils.java:18)
位于com.runtime.system.util.ShiroUtils.getUser(ShiroUtils.java:22)

这个问题在传统的Api接口中不存在。我感到很难过。请帮帮我,谢谢

开箱即用Shiro不知道如何处理运行异步请求的线程

您需要将数据与异步请求(通常是主题)关联,然后通过可运行/可调用的

Subject=;
subject.execute();

请参阅:

现成的Shiro不知道如何处理运行异步请求的线程

您需要将数据与异步请求(通常是主题)关联,然后通过可运行/可调用的

Subject=;
subject.execute();

请参阅:

非常感谢!非常感谢!
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton.  This is an invalid application configuration.
at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)
at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:626)
at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)
at com.runtime.system.util.ShiroUtils.getSubjct(ShiroUtils.java:18)
at com.runtime.system.util.ShiroUtils.getUser(ShiroUtils.java:22)