ScopeNotActiveException 异常
Posted ISaiSai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ScopeNotActiveException 异常相关的知识,希望对你有一定的参考价值。
@Scope(value = WebApplicationContext.SCOPE_REQUEST)
修改为
@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS)
问题解决
Unsatisfied dependency expressed through field 'subClass'; nested exception is org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'subClass': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: 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.
参考文档:https://blog.csdn.net/weixin_46535927/article/details/119149008?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2defaultCTRLISTdefault-1-119149008-blog-112874664.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2defaultCTRLISTdefault-1-119149008-blog-112874664.pc_relevant_default&utm_relevant_index=2
以上是关于ScopeNotActiveException 异常的主要内容,如果未能解决你的问题,请参考以下文章