Sorry for inundating the spring batch SO queue.
I moved on from the Job Scope pattern, since that appears to not work in XML configuration for 3.0.6. I could very well just be confused though.
I tried moving on to the step scope since that seems to work. This is my app-context.xml configuration header for my beans. This enables the scope="step" option.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
However, creating of those beans fails. Importantly, these are REST Easy client proxied beans. Which i am defining like so:
<bean id="rootServiceBean" scope="step"
class="com.myorg.ServiceProxyFactoryBean"
p:baseUri="${rest.base.uri}"
p:ticket="#{jobExecutionContext['jobSecrets']}" abstract="true"/>
and then on my instances:
<bean id="someServiceObject"
parent="rootServiceBean"
p:serviceInterface="com.myOrg.someServiceRest"/>
But I get errors cascading down from My top level job, its children jobs, its children steps, and those steps beans, which finally are caused by...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someService': Scope 'step' 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 context holder available for step scope at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:341) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 79 more Caused by: java.lang.IllegalStateException: No context holder available for step scope at org.springframework.batch.core.scope.StepScope.getContext(StepScope.java:167) at org.springframework.batch.core.scope.StepScope.get(StepScope.java:99) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:327) ... 81 more
Is there some context I need to initialize on my jobs? Or is spring-batch colliding with the proxy that rest easy client is leveraging?