问题描述
当 ActionMapper
, ActionProxy
, ActionInvocation
, ActionContext
是在Struts2应用程序中创建的.当我刚接触Struts2框架时,我对这些对象的范围感到非常困惑.
Can any one please describe me when the objects of ActionMapper
, ActionProxy
, ActionInvocation
, ActionContext
are created in a Struts2 application. As I am new to Struts2 framework, I am very much confused about the scopes of these objects.
推荐答案
ActionMapper
是在启动时创建的,具有单例作用域.
The ActionMapper
is created on startup, it has a singleton scope.
ActionContext
由 Dispatcher
创建在准备执行的操作中,它是 ThreadLocal ,它没有任何作用域.
The ActionContext
is created by the Dispatcher
in preparing an action to execute, it's ThreadLocal, and it doesn't have any scope.
执行操作时 和 ActionProxy
创建的也没有作用域.
When action is executing the ActionInvocation
and ActionProxy
are created that also don't have a scope.
您可以在Struts2体系结构的大图上看到这一点.
You can see this on a big picture of Struts2 architecture.
这篇关于Struts2中的ActionMapper,ActionProxy,ActionInvocation,ActionContext对象的范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!