原创

如何在 @RabbitListener 方法中创建 Authentication 对象?

温馨提示:
本文最后更新于 2024年04月12日,已超过 48 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

在我的应用程序中,有一个监听器,它使用需要Spring Security身份验证和请求信息的方法进行操作。不幸的是,这些方法在运行时没有身份验证令牌,并且请求未绑定到任何线程,因此当 RabbitMQ 尝试发送这些请求时,会引发异常:

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: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
正文到此结束
热门推荐
本文目录