类 JobScope
- java.lang.Object
- org.springframework.batch.core.scope.BatchScopeSupport
- org.springframework.batch.core.scope.JobScope
- 所有已实现的接口:
org.springframework.beans.factory.config.BeanFactoryPostProcessor
,org.springframework.beans.factory.config.Scope
,org.springframework.core.Ordered
public class JobScope extends BatchScopeSupport
Scope for job context. Objects in this scope use the Spring container as an object factory, so there is only one instance of such a bean per executing job. All objects in this scope are <aop:scoped-proxy/> (no need to decorate the bean definitions).
In addition, support is provided for late binding of references accessible from theJobContext
using #{..} placeholders. Using this feature, bean properties can be pulled from the job or job execution context and the job parameters. E.g.<bean id="..." class="..." scope="job"> <property name="name" value="#{jobParameters[input]}" /> </bean> <bean id="..." class="..." scope="job"> <property name="name" value="#{jobExecutionContext['input.stem']}.txt" /> </bean>
TheJobContext
is referenced using standard bean property paths (as perBeanWrapper
). The examples above all show the use of the Map accessors provided as a convenience for job attributes.- 从以下版本开始:
- 3.0
- 作者:
- Dave Syer, Jimmy Praet (create JobScope based on
StepScope
), Michael Minella
嵌套类概要
从类继承的嵌套类/接口 org.springframework.batch.core.scope.BatchScopeSupport
BatchScopeSupport.Scopifier
字段概要
字段 修饰符和类型 字段 说明 static java.lang.String
ID_KEY
Context key for clients to use for conversation identifier.
构造器概要
构造器 构造器 说明 JobScope()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 java.lang.Object
get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
java.lang.String
getConversationId()
java.lang.String
getTargetNamePrefix()
void
registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
java.lang.Object
remove(java.lang.String name)
java.lang.Object
resolveContextualObject(java.lang.String key)
This will be used to resolve expressions in job-scoped beans.从类继承的方法 org.springframework.batch.core.scope.BatchScopeSupport
createScopedProxy, getName, getOrder, postProcessBeanFactory, setAutoProxy, setName, setOrder, setProxyTargetClass
构造器详细资料
JobScope
public JobScope()
方法详细资料
resolveContextualObject
public java.lang.Object resolveContextualObject(java.lang.String key)
This will be used to resolve expressions in job-scoped beans.
get
public java.lang.Object get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
- 另请参阅:
Scope.get(String, ObjectFactory)
getConversationId
public java.lang.String getConversationId()
- 另请参阅:
Scope.getConversationId()
registerDestructionCallback
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
- 另请参阅:
Scope.registerDestructionCallback(String, Runnable)
remove
public java.lang.Object remove(java.lang.String name)
- 另请参阅:
Scope.remove(String)
getTargetNamePrefix
public java.lang.String getTargetNamePrefix()
- 指定者:
getTargetNamePrefix
在类中BatchScopeSupport