Session 在SpringWebSocket注释修饰的方法内调用会话对象时出错

Session 在SpringWebSocket注释修饰的方法内调用会话对象时出错,session,grails,spring-websocket,Session,Grails,Spring Websocket,使用: CurrentStatusController.groovy 保存会话列表中人员的所有idPersonID,然后使用会话对象处理相同的方法 CurrentStatusController.groovy 第一个可用,最后一个不可用,错误消息如下: ERROR springwebsocket.GrailsSimpAnnotationMethodMessageHandler - Unhandled exception Message: No thread-bound request foun

使用:

CurrentStatusController.groovy 保存
会话
列表中人员的所有id
PersonID
,然后使用会话对象处理相同的方法

CurrentStatusController.groovy 第一个可用,最后一个不可用,错误消息如下:

ERROR springwebsocket.GrailsSimpAnnotationMethodMessageHandler  -
Unhandled exception Message: No thread-bound request found: Are you
referring to request attributes outside of an actual web request, or
processing a request outside of the originally receiving thread? If
you are actually operating within a web request and still receive this
message, your code is probably running outside of
DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current
request.
    Line | Method
->>   53 | getSession in org.grails.plugins.web.rest.api.ControllersRestApi
如何使SpringWebSocket方法接受session对象?

SpringSession()解决了这种情况!
@MessageMapping("/personExist")
@SendTo("/topic/personExist")
protected Boolean personExist(String personId) {
    return (session.personIds.contains(personId))
}
ERROR springwebsocket.GrailsSimpAnnotationMethodMessageHandler  -
Unhandled exception Message: No thread-bound request found: Are you
referring to request attributes outside of an actual web request, or
processing a request outside of the originally receiving thread? If
you are actually operating within a web request and still receive this
message, your code is probably running outside of
DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current
request.
    Line | Method
->>   53 | getSession in org.grails.plugins.web.rest.api.ControllersRestApi