BATCH-2001: fix up property scoping, add support for resolving jobParameter references outside of step scope
This commit is contained in:
committed by
Michael Minella
parent
2c1b8e154a
commit
10e58baf80
@@ -39,10 +39,13 @@ public class StepContextFactoryBean implements FactoryBean<StepContext> {
|
||||
*/
|
||||
@Override
|
||||
public StepContext getObject() throws Exception {
|
||||
org.springframework.batch.core.StepExecution stepExecution = StepSynchronizationManager.getContext().getStepExecution();
|
||||
Properties properties = batchPropertyContext.getStepLevelProperties(stepExecution.getStepName());
|
||||
org.springframework.batch.core.scope.context.StepContext stepContext = StepSynchronizationManager.getContext();
|
||||
|
||||
return new StepContext(stepExecution, properties);
|
||||
String stepName = stepContext.getStepName();
|
||||
String jobName = stepContext.getStepExecution().getJobExecution().getJobInstance().getJobName();
|
||||
Properties properties = batchPropertyContext.getStepLevelProperties(jobName + "." + stepName);
|
||||
|
||||
return new StepContext(stepContext.getStepExecution(), properties);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -50,6 +50,8 @@ import javax.batch.api.partition.PartitionReducer;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.scope.StepScope;
|
||||
import org.springframework.batch.core.scope.context.StepContext;
|
||||
import org.springframework.batch.core.scope.context.StepSynchronizationManager;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
@@ -89,7 +91,9 @@ public class BatchPropertyBeanPostProcessor implements BeanPostProcessor, BeanFa
|
||||
return bean;
|
||||
}
|
||||
|
||||
final Properties artifactProperties = batchPropertyContext.getBatchProperties(beanName);
|
||||
String beanPropertyName = getBeanPropertyName(beanName);
|
||||
|
||||
final Properties artifactProperties = batchPropertyContext.getBatchProperties(beanPropertyName);
|
||||
|
||||
if (artifactProperties.isEmpty()) {
|
||||
return bean;
|
||||
@@ -100,6 +104,18 @@ public class BatchPropertyBeanPostProcessor implements BeanPostProcessor, BeanFa
|
||||
return bean;
|
||||
}
|
||||
|
||||
private String getBeanPropertyName(String beanName) {
|
||||
StepContext stepContext = StepSynchronizationManager.getContext();
|
||||
|
||||
if(stepContext != null) {
|
||||
String stepName = stepContext.getStepName();
|
||||
String jobName = stepContext.getStepExecution().getJobExecution().getJobInstance().getJobName();
|
||||
return jobName + "." + stepName + "." + beanName.substring("scopedTarget.".length());
|
||||
}
|
||||
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setRequiredAnnotations() {
|
||||
ClassLoader cl = BatchPropertyBeanPostProcessor.class.getClassLoader();
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.core.jsr.configuration.support;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class BatchPropertyContext {
|
||||
private static final String JOB_ARTIFACT_PROPERTY_PREFIX = "job-";
|
||||
private static final Pattern JOB_PATH_DELIMITER_PATTERN = Pattern.compile("\\.");
|
||||
|
||||
private ConcurrentHashMap<String, Properties> batchProperties = new ConcurrentHashMap<String, Properties>();
|
||||
|
||||
@@ -74,10 +76,9 @@ public class BatchPropertyContext {
|
||||
*/
|
||||
public Properties getStepLevelProperties(String beanName) {
|
||||
Properties properties = new Properties();
|
||||
String originalBeanName = getOriginalBeanName(beanName);
|
||||
|
||||
if (batchProperties.containsKey(originalBeanName)) {
|
||||
properties.putAll(batchProperties.get(originalBeanName));
|
||||
if (batchProperties.containsKey(beanName)) {
|
||||
properties.putAll(batchProperties.get(beanName));
|
||||
}
|
||||
|
||||
return properties;
|
||||
@@ -95,10 +96,9 @@ public class BatchPropertyContext {
|
||||
*/
|
||||
public Properties getBatchProperties(String beanName) {
|
||||
Properties properties = new Properties();
|
||||
String originalBeanName = getOriginalBeanName(beanName);
|
||||
|
||||
if (batchProperties.containsKey(originalBeanName)) {
|
||||
properties.putAll(batchProperties.get(originalBeanName));
|
||||
if (batchProperties.containsKey(beanName)) {
|
||||
properties.putAll(batchProperties.get(beanName));
|
||||
}
|
||||
|
||||
Properties jobLevelProperties = getJobProperties();
|
||||
@@ -123,7 +123,7 @@ public class BatchPropertyContext {
|
||||
Properties jobProperties = new Properties();
|
||||
|
||||
for (String jobLevelProperty : batchProperties.keySet()) {
|
||||
if (jobLevelProperty.startsWith(JOB_ARTIFACT_PROPERTY_PREFIX)) {
|
||||
if(isJobLevelComponentPath(jobLevelProperty)) {
|
||||
if (batchProperties.containsKey(jobLevelProperty)) {
|
||||
jobProperties.putAll(batchProperties.get(jobLevelProperty));
|
||||
break;
|
||||
@@ -134,12 +134,24 @@ public class BatchPropertyContext {
|
||||
return jobProperties;
|
||||
}
|
||||
|
||||
protected String getOriginalBeanName(String beanName) {
|
||||
if (beanName.startsWith("scopedTarget")) {
|
||||
return beanName.substring(13);
|
||||
// for now we assume properties are using a path format, currently: jobName.componentName.artifactName
|
||||
// componentName can be the step name, job name prefixed by job- etc
|
||||
protected boolean isJobLevelComponentPath(String jobLevelProperty) {
|
||||
if(jobLevelProperty == null || "".equals(jobLevelProperty)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return beanName;
|
||||
String[] path = JOB_PATH_DELIMITER_PATTERN.split(jobLevelProperty);
|
||||
|
||||
if (path.length >= 2) {
|
||||
String componentPath = path[1];
|
||||
|
||||
if (componentPath != null && componentPath.startsWith(JOB_ARTIFACT_PROPERTY_PREFIX)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.configuration.support;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionVisitor;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
@@ -26,6 +30,7 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
/**
|
||||
* After the {@link BeanFactory} is created, this post processor will evaluate to see
|
||||
@@ -33,18 +38,32 @@ import org.springframework.core.PriorityOrdered;
|
||||
* to class names instead of bean names. If this is the case, a new {@link BeanDefinition}
|
||||
* is added with the name of the class as the bean name.
|
||||
*
|
||||
* This post processor will also resolve values in bean definitions that represent
|
||||
* #{jobParameter['key']} expressions prior to the standard SPeL resolution if they correspond
|
||||
* with an entry in the user provided {@link Properties} to the start or restart methods of the
|
||||
* {@link org.springframework.batch.core.jsr.launch.JsrJobOperator}. This allows jobProperty
|
||||
* replacements to occur for elements that require resolution prior to context initialization
|
||||
* and are not step scoped.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
public class ThreadLocalClassloaderBeanPostProcessor implements BeanFactoryPostProcessor, PriorityOrdered {
|
||||
private JobParameterResolver jobParameterResolver;
|
||||
private static final Pattern JOB_PARAMETERS_KEY_PATTERN = Pattern.compile("'([^']*?)'");
|
||||
private static final Pattern JOB_PARAMETERS_PATTERN = Pattern.compile("(#\\{jobParameters[^}]+\\})");
|
||||
|
||||
public ThreadLocalClassloaderBeanPostProcessor(Properties properties) {
|
||||
this.jobParameterResolver = new JobParameterResolver(properties);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
|
||||
*/
|
||||
@Override
|
||||
public void postProcessBeanFactory(
|
||||
ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
String [] beanNames = beanFactory.getBeanDefinitionNames();
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
String[] beanNames = beanFactory.getBeanDefinitionNames();
|
||||
|
||||
for (String curName : beanNames) {
|
||||
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(curName);
|
||||
@@ -62,6 +81,8 @@ public class ThreadLocalClassloaderBeanPostProcessor implements BeanFactoryPostP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jobParameterResolver.visitBeanDefinition(beanDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,4 +94,57 @@ public class ThreadLocalClassloaderBeanPostProcessor implements BeanFactoryPostP
|
||||
public int getOrder() {
|
||||
return PriorityOrdered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
protected class JobParameterResolver {
|
||||
private Properties properties;
|
||||
private BeanDefinitionVisitor beanDefinitionVisitor;
|
||||
|
||||
public JobParameterResolver(Properties properties) {
|
||||
this.properties = properties;
|
||||
this.beanDefinitionVisitor = new BeanDefinitionVisitor(new JobParameterStringValueResolver());
|
||||
}
|
||||
|
||||
public void visitBeanDefinition(BeanDefinition beanDefinition) {
|
||||
if (properties != null && ! properties.isEmpty() && ! "step".equals(beanDefinition.getScope())) {
|
||||
beanDefinitionVisitor.visitBeanDefinition(beanDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
protected class JobParameterStringValueResolver implements StringValueResolver {
|
||||
@Override
|
||||
public String resolveStringValue(String value) {
|
||||
if (value != null && ! "".equals(value)) {
|
||||
String resolvedString = resolveJobProperties(value);
|
||||
|
||||
if (!"".equals(resolvedString)) {
|
||||
return resolvedString;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private String resolveJobProperties(String value) {
|
||||
StringBuffer valueBuffer = new StringBuffer();
|
||||
Matcher jobParameterMatcher = JOB_PARAMETERS_PATTERN.matcher(value);
|
||||
|
||||
while (jobParameterMatcher.find()) {
|
||||
Matcher jobParameterKeyMatcher = JOB_PARAMETERS_KEY_PATTERN.matcher(jobParameterMatcher.group(1));
|
||||
|
||||
if (jobParameterKeyMatcher.find()) {
|
||||
String extractedProperty = jobParameterKeyMatcher.group(1);
|
||||
|
||||
if (properties.containsKey(extractedProperty)) {
|
||||
String resolvedProperty = properties.getProperty(extractedProperty);
|
||||
jobParameterMatcher.appendReplacement(valueBuffer, resolvedProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jobParameterMatcher.appendTail(valueBuffer);
|
||||
|
||||
return valueBuffer.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ public class DecisionParser {
|
||||
|
||||
String idAttribute = element.getAttribute(ID_ATTRIBUTE);
|
||||
|
||||
PropertyParser.pushPath(idAttribute);
|
||||
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(factoryDefinition, idAttribute));
|
||||
stateBuilder.addConstructorArgReference(idAttribute);
|
||||
|
||||
@@ -63,6 +65,10 @@ public class DecisionParser {
|
||||
|
||||
new PropertyParser(refAttribute, parserContext).parseProperties(element);
|
||||
|
||||
return FlowParser.getNextElements(parserContext, stateBuilder.getBeanDefinition(), element);
|
||||
Collection<BeanDefinition> nextElements = FlowParser.getNextElements(parserContext, stateBuilder.getBeanDefinition(), element);
|
||||
|
||||
PropertyParser.popPath();
|
||||
|
||||
return nextElements;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,14 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
JsrNamespaceUtils.autoregisterJsrBeansForNamespace(parserContext);
|
||||
|
||||
String jobName = element.getAttribute(ID_ATTRIBUTE);
|
||||
|
||||
if(PropertyParser.hasPath()) {
|
||||
PropertyParser.clearPath();
|
||||
throw new IllegalArgumentException("Job parsing started for job name: " + jobName + " and property parser path already populated.");
|
||||
}
|
||||
|
||||
PropertyParser.pushPath(jobName);
|
||||
|
||||
builder.addConstructorArgValue(jobName);
|
||||
|
||||
String restartableAttribute = element.getAttribute(RESTARTABLE_ATTRIBUTE);
|
||||
@@ -66,6 +74,9 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
parserContext.getRegistry().registerBeanDefinition("stepContextFactory", stepContextBeanDefinition);
|
||||
|
||||
new ListnerParser(JobListenerFactoryBean.class, "jobExecutionListeners").parseListeners(element, parserContext, builder);
|
||||
|
||||
new PropertyParser(PropertyParser.JOB_ARTIFACT_PROPERTY_PREFIX + jobName, parserContext).parseProperties(element);
|
||||
|
||||
PropertyParser.popPath();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchPropertyBeanPostProcessor;
|
||||
import org.springframework.batch.core.jsr.configuration.support.JsrAutowiredAnnotationBeanPostProcessor;
|
||||
import org.springframework.batch.core.jsr.configuration.support.ThreadLocalClassloaderBeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
@@ -28,20 +27,15 @@ import org.springframework.context.annotation.AnnotationConfigUtils;
|
||||
* Utility methods used in parsing of the JSR-352 batch namespace
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Chris Schaefer
|
||||
* @since 3.0
|
||||
*/
|
||||
class JsrNamespaceUtils {
|
||||
private static final String BATCH_PROPERTY_POST_PROCESSOR_BEAN_NAME = "batchPropertyPostProcessor";
|
||||
private static final String THREAD_LOCAL_CLASSLOASER_BEAN_POST_PROCESSOR_BEAN_NAME = "threadLocalClassloaderBeanPostProcessor";
|
||||
|
||||
static void autoregisterJsrBeansForNamespace(ParserContext parserContext) {
|
||||
autoRegisterBatchPostProcessor(parserContext);
|
||||
autoRegisterJsrAutowiredAnnotationBeanPostProcessor(parserContext);
|
||||
autoRegisterThreadLocalClassloaderBeanPostProcessor(parserContext);
|
||||
}
|
||||
|
||||
private static void autoRegisterThreadLocalClassloaderBeanPostProcessor(ParserContext parserContext) {
|
||||
registerPostProcessor(parserContext, ThreadLocalClassloaderBeanPostProcessor.class, BeanDefinition.ROLE_INFRASTRUCTURE, THREAD_LOCAL_CLASSLOASER_BEAN_POST_PROCESSOR_BEAN_NAME);
|
||||
}
|
||||
|
||||
private static void autoRegisterBatchPostProcessor(ParserContext parserContext) {
|
||||
@@ -53,15 +47,11 @@ class JsrNamespaceUtils {
|
||||
}
|
||||
|
||||
private static void registerPostProcessor(ParserContext parserContext, Class<?> clazz, int role, String beanName) {
|
||||
BeanDefinitionBuilder jsrAutowiredAnnotationBeanPostProcessor =
|
||||
BeanDefinitionBuilder.genericBeanDefinition(clazz);
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(clazz);
|
||||
|
||||
AbstractBeanDefinition jsrAutowiredAnnotationBeanPostProcessorDefinition =
|
||||
jsrAutowiredAnnotationBeanPostProcessor.getBeanDefinition();
|
||||
AbstractBeanDefinition beanDefinition = beanDefinitionBuilder.getBeanDefinition();
|
||||
beanDefinition.setRole(role);
|
||||
|
||||
jsrAutowiredAnnotationBeanPostProcessorDefinition.setRole(role);
|
||||
|
||||
parserContext.getRegistry().registerBeanDefinition(beanName,
|
||||
jsrAutowiredAnnotationBeanPostProcessorDefinition);
|
||||
parserContext.getRegistry().registerBeanDefinition(beanName, beanDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -48,6 +51,7 @@ public class PropertyParser {
|
||||
private static final String BATCH_CONTEXT_ENTRIES_PROPERTY_NAME = "batchContextEntries";
|
||||
private static final String BATCH_PROPERTY_CONTEXT_BEAN_CLASS_NAME = "org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext";
|
||||
private static final String BATCH_PROPERTY_CONTEXT_BEAN_NAME = "batchPropertyContext";
|
||||
private static final Deque<String> PATH = new LinkedList<String>();
|
||||
|
||||
private String beanName;
|
||||
private ParserContext parserContext;
|
||||
@@ -60,6 +64,26 @@ public class PropertyParser {
|
||||
registerJobProperties();
|
||||
}
|
||||
|
||||
public PropertyParser(ParserContext parserContext) {
|
||||
this("", parserContext);
|
||||
}
|
||||
|
||||
public static void pushPath(String pathElement) {
|
||||
PATH.push(pathElement);
|
||||
}
|
||||
|
||||
public static void popPath() {
|
||||
PATH.pop();
|
||||
}
|
||||
|
||||
public static boolean hasPath() {
|
||||
return !PATH.isEmpty();
|
||||
}
|
||||
|
||||
public static void clearPath() {
|
||||
PATH.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Parses <property> tag values from the provided {@link Element} if it contains a <properties /> element.
|
||||
@@ -94,7 +118,7 @@ public class PropertyParser {
|
||||
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
BatchPropertyContext.BatchPropertyContextEntry batchPropertyContextEntry =
|
||||
batchPropertyContext.new BatchPropertyContextEntry(beanName, properties);
|
||||
batchPropertyContext.new BatchPropertyContextEntry(getContextEntryKey(), properties);
|
||||
|
||||
ManagedList<BatchPropertyContext.BatchPropertyContextEntry> managedList = new ManagedList<BatchPropertyContext.BatchPropertyContextEntry>();
|
||||
managedList.setMergeEnabled(true);
|
||||
@@ -138,4 +162,23 @@ public class PropertyParser {
|
||||
jobPropertiesBeanDefinition.getConstructorArgumentValues().addGenericArgumentValue(jobProperties);
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath() {
|
||||
StringBuilder pathBuilder = new StringBuilder();
|
||||
Iterator pathIterator = PATH.descendingIterator();
|
||||
|
||||
if (pathIterator.hasNext()) {
|
||||
pathBuilder.append(pathIterator.next());
|
||||
|
||||
while (pathIterator.hasNext()) {
|
||||
pathBuilder.append(".").append(pathIterator.next());
|
||||
}
|
||||
}
|
||||
|
||||
return pathBuilder.toString();
|
||||
}
|
||||
|
||||
private String getContextEntryKey() {
|
||||
return "".equals(beanName) ? getPath() : getPath() + "." + beanName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,9 @@ public class StepParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String stepName = element.getAttribute(SPLIT_ID_ATTRIBUTE);
|
||||
builder.addPropertyValue("name", stepName);
|
||||
|
||||
PropertyParser.pushPath(stepName);
|
||||
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(bd, stepName));
|
||||
stateBuilder.addConstructorArgReference(stepName);
|
||||
|
||||
@@ -69,7 +72,7 @@ public class StepParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
|
||||
new ListnerParser(StepListenerFactoryBean.class, "listeners").parseListeners(element, parserContext, bd);
|
||||
new PropertyParser(stepName, parserContext).parseProperties(element);
|
||||
new PropertyParser(parserContext).parseProperties(element);
|
||||
|
||||
// look at all nested elements
|
||||
NodeList children = element.getChildNodes();
|
||||
@@ -89,6 +92,10 @@ public class StepParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
}
|
||||
|
||||
return FlowParser.getNextElements(parserContext, stepName, stateBuilder.getBeanDefinition(), element);
|
||||
Collection<BeanDefinition> nextElements = FlowParser.getNextElements(parserContext, stepName, stateBuilder.getBeanDefinition(), element);
|
||||
|
||||
PropertyParser.popPath();
|
||||
|
||||
return nextElements;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.jsr.JobContext;
|
||||
import org.springframework.batch.core.jsr.JsrJobParametersConverter;
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext;
|
||||
import org.springframework.batch.core.jsr.configuration.support.ThreadLocalClassloaderBeanPostProcessor;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.beans.factory.access.BeanFactoryLocator;
|
||||
import org.springframework.beans.factory.access.BeanFactoryReference;
|
||||
@@ -427,6 +428,7 @@ public class JsrJobOperator implements JobOperator {
|
||||
batchContext.load(jobXml);
|
||||
}
|
||||
|
||||
batchContext.addBeanFactoryPostProcessor(new ThreadLocalClassloaderBeanPostProcessor(params));
|
||||
batchContext.setParent(baseContext);
|
||||
batchContext.refresh();
|
||||
|
||||
@@ -508,6 +510,7 @@ public class JsrJobOperator implements JobOperator {
|
||||
batchContext.load(jobXml);
|
||||
}
|
||||
|
||||
batchContext.addBeanFactoryPostProcessor(new ThreadLocalClassloaderBeanPostProcessor(params));
|
||||
batchContext.setParent(baseContext);
|
||||
batchContext.refresh();
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Properties;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
@@ -37,20 +38,20 @@ public class BatchPropertyContextTests {
|
||||
public void setUp() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties bean1Properties = new Properties();
|
||||
bean1Properties.setProperty("readerName", "bean1readerName");
|
||||
bean1Properties.setProperty("readerWriter", "bean1writerName");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("bean1", bean1Properties));
|
||||
Properties step1Properties = new Properties();
|
||||
step1Properties.setProperty("step1PropertyName1", "step1PropertyValue1");
|
||||
step1Properties.setProperty("step1PropertyName2", "step1PropertyValue2");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.step1", step1Properties));
|
||||
|
||||
Properties bean2Properties = new Properties();
|
||||
bean2Properties.setProperty("readerName", "bean2readerName");
|
||||
bean2Properties.setProperty("readerWriter", "bean2writerName");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("bean2", bean2Properties));
|
||||
Properties step2Properties = new Properties();
|
||||
step2Properties.setProperty("step2PropertyName1", "step2PropertyValue1");
|
||||
step2Properties.setProperty("step2PropertyName2", "step2PropertyValue2");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.step2", step2Properties));
|
||||
|
||||
Properties jobProperties = new Properties();
|
||||
jobProperties.setProperty("jobProperty1", "jobProperty1value");
|
||||
jobProperties.setProperty("jobProperty2", "jobProperty2value");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job-testJob", jobProperties));
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.job-job1", jobProperties));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -58,21 +59,21 @@ public class BatchPropertyContextTests {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean1 = batchPropertyContext.getBatchProperties("bean1");
|
||||
assertEquals(4, bean1.size());
|
||||
assertEquals("bean1readerName", bean1.getProperty("readerName"));
|
||||
assertEquals("bean1writerName", bean1.getProperty("readerWriter"));
|
||||
assertEquals("jobProperty1value", bean1.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean1.getProperty("jobProperty2"));
|
||||
Properties step1BatchProperties = batchPropertyContext.getBatchProperties("job1.step1");
|
||||
assertEquals(4, step1BatchProperties.size());
|
||||
assertEquals("step1PropertyValue1", step1BatchProperties.getProperty("step1PropertyName1"));
|
||||
assertEquals("step1PropertyValue2", step1BatchProperties.getProperty("step1PropertyName2"));
|
||||
assertEquals("jobProperty1value", step1BatchProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", step1BatchProperties.getProperty("jobProperty2"));
|
||||
|
||||
Properties bean2 = batchPropertyContext.getBatchProperties("bean2");
|
||||
assertEquals(4, bean2.size());
|
||||
assertEquals("bean2readerName", bean2.getProperty("readerName"));
|
||||
assertEquals("bean2writerName", bean2.getProperty("readerWriter"));
|
||||
assertEquals("jobProperty1value", bean2.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean2.getProperty("jobProperty2"));
|
||||
Properties step2BatchProperties = batchPropertyContext.getBatchProperties("job1.step2");
|
||||
assertEquals(4, step2BatchProperties.size());
|
||||
assertEquals("step2PropertyValue1", step2BatchProperties.getProperty("step2PropertyName1"));
|
||||
assertEquals("step2PropertyValue2", step2BatchProperties.getProperty("step2PropertyName2"));
|
||||
assertEquals("jobProperty1value", step2BatchProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", step2BatchProperties.getProperty("jobProperty2"));
|
||||
|
||||
Properties jobProperties = batchPropertyContext.getBatchProperties("job-testJob");
|
||||
Properties jobProperties = batchPropertyContext.getBatchProperties("job1.job-job1");
|
||||
assertEquals(2, jobProperties.size());
|
||||
assertEquals("jobProperty1value", jobProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", jobProperties.getProperty("jobProperty2"));
|
||||
@@ -82,17 +83,17 @@ public class BatchPropertyContextTests {
|
||||
public void testAddBatchContextEntriesToExistingArtifact() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties bean2Properties = new Properties();
|
||||
bean2Properties.setProperty("processorName", "bean2processorName");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("bean2", bean2Properties));
|
||||
Properties step1properties = new Properties();
|
||||
step1properties.setProperty("newStep1PropertyName", "newStep1PropertyValue");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.step1", step1properties));
|
||||
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean2 = batchPropertyContext.getBatchProperties("bean2");
|
||||
Properties bean2 = batchPropertyContext.getBatchProperties("job1.step1");
|
||||
assertEquals(5, bean2.size());
|
||||
assertEquals("bean2readerName", bean2.getProperty("readerName"));
|
||||
assertEquals("bean2writerName", bean2.getProperty("readerWriter"));
|
||||
assertEquals("bean2processorName", bean2.getProperty("processorName"));
|
||||
assertEquals("step1PropertyValue1", bean2.getProperty("step1PropertyName1"));
|
||||
assertEquals("step1PropertyValue2", bean2.getProperty("step1PropertyName2"));
|
||||
assertEquals("newStep1PropertyValue", bean2.getProperty("newStep1PropertyName"));
|
||||
assertEquals("jobProperty1value", bean2.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean2.getProperty("jobProperty2"));
|
||||
}
|
||||
@@ -102,78 +103,15 @@ public class BatchPropertyContextTests {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean1 = batchPropertyContext.getStepLevelProperties("bean1");
|
||||
Properties bean1 = batchPropertyContext.getStepLevelProperties("job1.step1");
|
||||
assertEquals(2, bean1.size());
|
||||
assertEquals("bean1readerName", bean1.getProperty("readerName"));
|
||||
assertEquals("bean1writerName", bean1.getProperty("readerWriter"));
|
||||
assertEquals("step1PropertyValue1", bean1.getProperty("step1PropertyName1"));
|
||||
assertEquals("step1PropertyValue2", bean1.getProperty("step1PropertyName2"));
|
||||
|
||||
Properties bean2 = batchPropertyContext.getStepLevelProperties("bean2");
|
||||
Properties bean2 = batchPropertyContext.getStepLevelProperties("job1.step2");
|
||||
assertEquals(2, bean2.size());
|
||||
assertEquals("bean2readerName", bean2.getProperty("readerName"));
|
||||
assertEquals("bean2writerName", bean2.getProperty("readerWriter"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetScopedStepLevelProperties() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties scopedBeanProperties = new Properties();
|
||||
scopedBeanProperties.setProperty("scopedBeanName", "scopedBeanValue");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("scopedBean", scopedBeanProperties));
|
||||
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean1 = batchPropertyContext.getStepLevelProperties("bean1");
|
||||
assertEquals(2, bean1.size());
|
||||
assertEquals("bean1readerName", bean1.getProperty("readerName"));
|
||||
assertEquals("bean1writerName", bean1.getProperty("readerWriter"));
|
||||
|
||||
Properties bean2 = batchPropertyContext.getStepLevelProperties("bean2");
|
||||
assertEquals(2, bean2.size());
|
||||
assertEquals("bean2readerName", bean2.getProperty("readerName"));
|
||||
assertEquals("bean2writerName", bean2.getProperty("readerWriter"));
|
||||
|
||||
Properties scopedBean = batchPropertyContext.getStepLevelProperties("scopedTarget.scopedBean");
|
||||
assertEquals(1, scopedBean.size());
|
||||
assertEquals("scopedBeanValue", scopedBean.getProperty("scopedBeanName"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetScopedBatchProperties() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties scopedBeanProperties = new Properties();
|
||||
scopedBeanProperties.setProperty("scopedBeanName", "scopedBeanValue");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("scopedBean", scopedBeanProperties));
|
||||
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean1 = batchPropertyContext.getBatchProperties("bean1");
|
||||
assertEquals(4, bean1.size());
|
||||
assertEquals("bean1readerName", bean1.getProperty("readerName"));
|
||||
assertEquals("bean1writerName", bean1.getProperty("readerWriter"));
|
||||
assertEquals("jobProperty1value", bean1.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean1.getProperty("jobProperty2"));
|
||||
|
||||
Properties bean2 = batchPropertyContext.getBatchProperties("bean2");
|
||||
assertEquals(4, bean2.size());
|
||||
assertEquals("bean2readerName", bean2.getProperty("readerName"));
|
||||
assertEquals("bean2writerName", bean2.getProperty("readerWriter"));
|
||||
assertEquals("jobProperty1value", bean2.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean2.getProperty("jobProperty2"));
|
||||
|
||||
Properties scopedBean = batchPropertyContext.getBatchProperties("scopedTarget.scopedBean");
|
||||
assertEquals(3, scopedBean.size());
|
||||
assertEquals("scopedBeanValue", scopedBean.getProperty("scopedBeanName"));
|
||||
assertEquals("jobProperty1value", scopedBean.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", scopedBean.getProperty("jobProperty2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetOriginalBeanName() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
String originalName = batchPropertyContext.getOriginalBeanName("scopedTarget.myBean");
|
||||
assertTrue(originalName.equals("myBean"));
|
||||
assertEquals("step2PropertyValue1", bean2.getProperty("step2PropertyName1"));
|
||||
assertEquals("step2PropertyValue2", bean2.getProperty("step2PropertyName2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -185,7 +123,6 @@ public class BatchPropertyContextTests {
|
||||
assertEquals(2, jobProperties.size());
|
||||
assertEquals("jobProperty1value", jobProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", jobProperties.getProperty("jobProperty2"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,22 +130,52 @@ public class BatchPropertyContextTests {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties jobProperties = new Properties();
|
||||
jobProperties.setProperty("readerName", "testJobreaderName");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job-testJob", jobProperties));
|
||||
jobProperties.setProperty("step1PropertyName1", "step1PropertyOverride");
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.job-job1", jobProperties));
|
||||
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties bean1 = batchPropertyContext.getBatchProperties("bean1");
|
||||
Properties bean1 = batchPropertyContext.getBatchProperties("job1.step1");
|
||||
assertEquals(4, bean1.size());
|
||||
assertEquals("bean1readerName", bean1.getProperty("readerName"));
|
||||
assertEquals("bean1writerName", bean1.getProperty("readerWriter"));
|
||||
assertEquals("step1PropertyValue1", bean1.getProperty("step1PropertyName1"));
|
||||
assertEquals("step1PropertyValue2", bean1.getProperty("step1PropertyName2"));
|
||||
assertEquals("jobProperty1value", bean1.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", bean1.getProperty("jobProperty2"));
|
||||
|
||||
Properties testJobBean = batchPropertyContext.getBatchProperties("job-testJob");
|
||||
Properties testJobBean = batchPropertyContext.getBatchProperties("job1.job-job1");
|
||||
assertEquals(3, testJobBean.size());
|
||||
assertEquals("testJobreaderName", testJobBean.getProperty("readerName"));
|
||||
assertEquals("step1PropertyOverride", testJobBean.getProperty("step1PropertyName1"));
|
||||
assertEquals("jobProperty1value", testJobBean.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", testJobBean.getProperty("jobProperty2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJobLevelPropertiesWithPath() {
|
||||
List<BatchPropertyContext.BatchPropertyContextEntry> entries = new ArrayList<BatchPropertyContext.BatchPropertyContextEntry>();
|
||||
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
|
||||
Properties jobProperties = new Properties();
|
||||
jobProperties.setProperty("readerName", "testJobreaderName");
|
||||
|
||||
entries.add(batchPropertyContext.new BatchPropertyContextEntry("job1.job-job1.itemReader", jobProperties));
|
||||
|
||||
batchPropertyContext.setBatchContextEntries(entries);
|
||||
|
||||
Properties props = batchPropertyContext.getJobProperties();
|
||||
assertEquals(1, props.size());
|
||||
assertEquals("testJobreaderName", props.getProperty("readerName"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJobLevelComponentPath() {
|
||||
BatchPropertyContext batchPropertyContext = new BatchPropertyContext();
|
||||
assertTrue(batchPropertyContext.isJobLevelComponentPath("myJob.job-myJob"));
|
||||
assertTrue(batchPropertyContext.isJobLevelComponentPath("myJob.job-myJob.myReader"));
|
||||
assertTrue(batchPropertyContext.isJobLevelComponentPath("myJob.job-myJob.myReader.something"));
|
||||
assertFalse(batchPropertyContext.isJobLevelComponentPath("myJob"));
|
||||
assertFalse(batchPropertyContext.isJobLevelComponentPath("job-myJob"));
|
||||
assertFalse(batchPropertyContext.isJobLevelComponentPath(null));
|
||||
assertFalse(batchPropertyContext.isJobLevelComponentPath("myJob."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,24 +53,8 @@ public class JobPropertySubstitutionTests {
|
||||
@Autowired
|
||||
private JobLauncher jobLauncher;
|
||||
|
||||
@Autowired
|
||||
private TestItemWriter testItemWriter;
|
||||
|
||||
@Autowired
|
||||
private TestItemReader testItemReader;
|
||||
|
||||
@Test
|
||||
public void testSystemPropertySubstitution() throws Exception {
|
||||
assertEquals(System.getProperty("file.separator"), testItemReader.readerPropertyName1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJobPropertySubstitution() throws Exception {
|
||||
assertEquals("jobPropertyValue1", testItemWriter.writerPropertyName1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJobParameterSubstitution() throws Exception {
|
||||
public void testPropertySubstitutionSimple() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job,
|
||||
new JobParametersBuilder().addString("testParam", "testParamValue").toJobParameters());
|
||||
assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
|
||||
@@ -85,7 +69,7 @@ public class JobPropertySubstitutionTests {
|
||||
|
||||
@Override
|
||||
public void open(Serializable serializable) throws Exception {
|
||||
|
||||
assertEquals(System.getProperty("file.separator"), readerPropertyName1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +99,7 @@ public class JobPropertySubstitutionTests {
|
||||
|
||||
@Override
|
||||
public void open(Serializable serializable) throws Exception {
|
||||
|
||||
assertEquals("jobPropertyValue1", writerPropertyName1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,10 +25,9 @@ import javax.batch.api.chunk.CheckpointAlgorithm;
|
||||
import javax.batch.api.chunk.ItemProcessor;
|
||||
import javax.batch.api.chunk.ItemReader;
|
||||
import javax.batch.api.chunk.ItemWriter;
|
||||
import javax.batch.api.listener.StepListener;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
@@ -43,10 +38,11 @@ import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Test cases for parsing various <properties /> elements defined by JSR-352.
|
||||
* Configuration test for parsing various <properties /> elements defined by JSR-352.
|
||||
* </p>
|
||||
*
|
||||
* @author Chris Schaefer
|
||||
@@ -54,124 +50,24 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class JobPropertyTests {
|
||||
@Autowired
|
||||
private TestItemReader testItemReader;
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
@Autowired
|
||||
private JobLauncher jobLauncher;
|
||||
|
||||
@Autowired
|
||||
private TestItemProcessor testItemProcessor;
|
||||
|
||||
@Autowired
|
||||
private TestItemWriter testItemWriter;
|
||||
|
||||
@Autowired
|
||||
private TestCheckpointAlgorithm testCheckpointAlgorithm;
|
||||
|
||||
@Autowired
|
||||
private TestDecider testDecider;
|
||||
|
||||
@Autowired
|
||||
private TestStepListener testStepListener;
|
||||
|
||||
@Autowired
|
||||
private TestBatchlet testBatchlet;
|
||||
|
||||
@Test
|
||||
public void testJobLevelPropertiesInItemReader() throws Exception {
|
||||
assertEquals("jobPropertyValue1", testItemReader.getJobPropertyName1());
|
||||
assertEquals("jobPropertyValue2", testItemReader.getJobPropertyName2());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStepContextProperties() throws Exception {
|
||||
public void testJobPropertyConfiguration() throws Exception {
|
||||
JobExecution jobExecution = jobLauncher.run(job, new JobParameters());
|
||||
assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemReaderProperties() throws Exception {
|
||||
assertEquals("readerPropertyValue1", testItemReader.getReaderPropertyName1());
|
||||
assertEquals("readerPropertyValue2", testItemReader.getReaderPropertyName2());
|
||||
assertEquals("annotationNamedReaderPropertyValue", testItemReader.getAnnotationNamedProperty());
|
||||
assertNull(testItemReader.getNotDefinedProperty());
|
||||
assertNull(testItemReader.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemProcessorProperties() throws Exception {
|
||||
Assert.assertEquals("processorPropertyValue1", testItemProcessor.getProcessorPropertyName1());
|
||||
Assert.assertEquals("processorPropertyValue2", testItemProcessor.getProcessorPropertyName2());
|
||||
assertEquals("annotationNamedProcessorPropertyValue", testItemProcessor.getAnnotationNamedProperty());
|
||||
assertNull(testItemProcessor.getNotDefinedProperty());
|
||||
assertNull(testItemProcessor.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemWriterProperties() throws Exception {
|
||||
Assert.assertEquals("writerPropertyValue1", testItemWriter.getWriterPropertyName1());
|
||||
Assert.assertEquals("writerPropertyValue2", testItemWriter.getWriterPropertyName2());
|
||||
assertEquals("annotationNamedWriterPropertyValue", testItemWriter.getAnnotationNamedProperty());
|
||||
assertNull(testItemWriter.getNotDefinedProperty());
|
||||
assertNull(testItemWriter.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckpointAlgorithmProperties() throws Exception {
|
||||
Assert.assertEquals("algorithmPropertyValue1", testCheckpointAlgorithm.getAlgorithmPropertyName1());
|
||||
Assert.assertEquals("algorithmPropertyValue2", testCheckpointAlgorithm.getAlgorithmPropertyName2());
|
||||
assertEquals("annotationNamedAlgorithmPropertyValue", testCheckpointAlgorithm.getAnnotationNamedProperty());
|
||||
assertNull(testCheckpointAlgorithm.getNotDefinedProperty());
|
||||
assertNull(testCheckpointAlgorithm.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeciderProperties() throws Exception {
|
||||
Assert.assertEquals("deciderPropertyValue1", testDecider.getDeciderPropertyName1());
|
||||
Assert.assertEquals("deciderPropertyValue2", testDecider.getDeciderPropertyName2());
|
||||
assertEquals("annotationNamedDeciderPropertyValue", testDecider.getAnnotationNamedProperty());
|
||||
assertNull(testDecider.getNotDefinedProperty());
|
||||
assertNull(testDecider.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStepListenerProperties() throws Exception {
|
||||
Assert.assertEquals("stepListenerPropertyValue1", testStepListener.getStepListenerPropertyName1());
|
||||
Assert.assertEquals("stepListenerPropertyValue2", testStepListener.getStepListenerPropertyName2());
|
||||
assertEquals("annotationNamedStepListenerPropertyValue", testStepListener.getAnnotationNamedProperty());
|
||||
assertNull(testStepListener.getNotDefinedProperty());
|
||||
assertNull(testStepListener.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBatchletProperties() throws Exception {
|
||||
Assert.assertEquals("batchletPropertyValue1", testBatchlet.getBatchletPropertyName1());
|
||||
Assert.assertEquals("batchletPropertyValue2", testBatchlet.getBatchletPropertyName2());
|
||||
assertEquals("annotationNamedBatchletPropertyValue", testBatchlet.getAnnotationNamedProperty());
|
||||
assertNull(testBatchlet.getNotDefinedProperty());
|
||||
assertNull(testBatchlet.getNotDefinedAnnotationNamedProperty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFieldWithInjectAnnotationOnlyInjects() throws Exception {
|
||||
assertNotNull(testItemReader.getInjectAnnotatedOnlyField());
|
||||
assertEquals("Chris", testItemReader.getInjectAnnotatedOnlyField().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFieldWithBatchPropertyAnnotationOnlyNoInjection() throws Exception {
|
||||
assertNull(testItemReader.getBatchAnnotatedOnlyField());
|
||||
}
|
||||
|
||||
public static final class TestItemReader implements ItemReader {
|
||||
private int cnt;
|
||||
|
||||
@Inject @BatchProperty String readerPropertyName1;
|
||||
@Inject @BatchProperty String readerPropertyName2;
|
||||
@Inject @BatchProperty String readerPropertyName3;
|
||||
@Inject @BatchProperty(name = "annotationNamedReaderPropertyName") String annotationNamedProperty;
|
||||
@Inject @BatchProperty String notDefinedProperty;
|
||||
@Inject @BatchProperty(name = "notDefinedAnnotationNamedProperty") String notDefinedAnnotationNamedProperty;
|
||||
@@ -188,8 +84,19 @@ public class JobPropertyTests {
|
||||
org.springframework.util.Assert.isNull(stepContext.getProperties().get("step2PropertyName2"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("step1PropertyName1").equals("step1PropertyValue1"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("step1PropertyName2").equals("step1PropertyValue2"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName1").equals("jobPropertyValue1"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName2").equals("jobPropertyValue2"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName1") == null);
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName2") == null);
|
||||
org.springframework.util.Assert.isTrue("jobPropertyValue1".equals(jobPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("jobPropertyValue2".equals(jobPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("readerPropertyValue1".equals(readerPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("readerPropertyValue2".equals(readerPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedReaderPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
org.springframework.util.Assert.isNull(batchAnnotatedOnlyField);
|
||||
org.springframework.util.Assert.notNull(injectAnnotatedOnlyField);
|
||||
org.springframework.util.Assert.isTrue("Chris".equals(injectAnnotatedOnlyField.getName()));
|
||||
org.springframework.util.Assert.isNull(readerPropertyName3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,42 +117,6 @@ public class JobPropertyTests {
|
||||
public Serializable checkpointInfo() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
String getReaderPropertyName1() {
|
||||
return readerPropertyName1;
|
||||
}
|
||||
|
||||
String getReaderPropertyName2() {
|
||||
return readerPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
|
||||
String getJobPropertyName1() {
|
||||
return jobPropertyName1;
|
||||
}
|
||||
|
||||
String getJobPropertyName2() {
|
||||
return jobPropertyName2;
|
||||
}
|
||||
|
||||
InjectTestObj getInjectAnnotatedOnlyField() {
|
||||
return injectAnnotatedOnlyField;
|
||||
}
|
||||
|
||||
String getBatchAnnotatedOnlyField() {
|
||||
return batchAnnotatedOnlyField;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TestItemProcessor implements ItemProcessor {
|
||||
@@ -257,28 +128,14 @@ public class JobPropertyTests {
|
||||
|
||||
@Override
|
||||
public Object processItem(Object o) throws Exception {
|
||||
org.springframework.util.Assert.isTrue("processorPropertyValue1".equals(processorPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("processorPropertyValue2".equals(processorPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedProcessorPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
String getProcessorPropertyName1() {
|
||||
return processorPropertyName1;
|
||||
}
|
||||
|
||||
String getProcessorPropertyName2() {
|
||||
return processorPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TestItemWriter implements ItemWriter {
|
||||
@@ -290,6 +147,11 @@ public class JobPropertyTests {
|
||||
|
||||
@Override
|
||||
public void open(Serializable serializable) throws Exception {
|
||||
org.springframework.util.Assert.isTrue("writerPropertyValue1".equals(writerPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("writerPropertyValue2".equals(writerPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedWriterPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,26 +167,6 @@ public class JobPropertyTests {
|
||||
public Serializable checkpointInfo() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
String getWriterPropertyName1() {
|
||||
return writerPropertyName1;
|
||||
}
|
||||
|
||||
String getWriterPropertyName2() {
|
||||
return writerPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TestCheckpointAlgorithm implements CheckpointAlgorithm {
|
||||
@@ -334,26 +176,6 @@ public class JobPropertyTests {
|
||||
@Inject @BatchProperty String notDefinedProperty;
|
||||
@Inject @BatchProperty(name = "notDefinedAnnotationNamedProperty") String notDefinedAnnotationNamedProperty;
|
||||
|
||||
String getAlgorithmPropertyName1() {
|
||||
return algorithmPropertyName1;
|
||||
}
|
||||
|
||||
String getAlgorithmPropertyName2() {
|
||||
return algorithmPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkpointTimeout() throws Exception {
|
||||
return 0;
|
||||
@@ -361,6 +183,11 @@ public class JobPropertyTests {
|
||||
|
||||
@Override
|
||||
public void beginCheckpoint() throws Exception {
|
||||
org.springframework.util.Assert.isTrue("algorithmPropertyValue1".equals(algorithmPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("algorithmPropertyValue2".equals(algorithmPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedAlgorithmPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -380,35 +207,19 @@ public class JobPropertyTests {
|
||||
@Inject @BatchProperty String notDefinedProperty;
|
||||
@Inject @BatchProperty(name = "notDefinedAnnotationNamedProperty") String notDefinedAnnotationNamedProperty;
|
||||
|
||||
String getDeciderPropertyName1() {
|
||||
return deciderPropertyName1;
|
||||
}
|
||||
|
||||
String getDeciderPropertyName2() {
|
||||
return deciderPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decide(javax.batch.runtime.StepExecution[] executions)
|
||||
throws Exception {
|
||||
public String decide(javax.batch.runtime.StepExecution[] executions) throws Exception {
|
||||
org.springframework.util.Assert.isTrue("deciderPropertyValue1".equals(deciderPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("deciderPropertyValue2".equals(deciderPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedDeciderPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
|
||||
return "step2";
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestStepListener implements javax.batch.api.chunk.listener.ItemReadListener,
|
||||
javax.batch.api.chunk.listener.ItemProcessListener, javax.batch.api.chunk.listener.ItemWriteListener {
|
||||
public static class TestStepListener implements StepListener {
|
||||
@Inject @BatchProperty String stepListenerPropertyName1;
|
||||
@Inject @BatchProperty String stepListenerPropertyName2;
|
||||
@Inject @BatchProperty(name = "annotationNamedStepListenerPropertyName") String annotationNamedProperty;
|
||||
@@ -416,59 +227,16 @@ public class JobPropertyTests {
|
||||
@Inject @BatchProperty(name = "notDefinedAnnotationNamedProperty") String notDefinedAnnotationNamedProperty;
|
||||
|
||||
@Override
|
||||
public void beforeProcess(Object o) throws Exception {
|
||||
public void beforeStep() throws Exception {
|
||||
org.springframework.util.Assert.isTrue("stepListenerPropertyValue1".equals(stepListenerPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("stepListenerPropertyValue2".equals(stepListenerPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedStepListenerPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterProcess(Object o, Object o2) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessError(Object o, Exception e) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeRead() throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterRead(Object o) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReadError(Exception e) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeWrite(List<Object> objects) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterWrite(List<Object> objects) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWriteError(List<Object> objects, Exception e) throws Exception {
|
||||
}
|
||||
|
||||
String getStepListenerPropertyName1() {
|
||||
return stepListenerPropertyName1;
|
||||
}
|
||||
|
||||
String getStepListenerPropertyName2() {
|
||||
return stepListenerPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
public void afterStep() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,32 +258,18 @@ public class JobPropertyTests {
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName1") == null);
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName2") == null);
|
||||
|
||||
org.springframework.util.Assert.isTrue("batchletPropertyValue1".equals(batchletPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("batchletPropertyValue2".equals(batchletPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedBatchletPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
}
|
||||
|
||||
String getBatchletPropertyName1() {
|
||||
return batchletPropertyName1;
|
||||
}
|
||||
|
||||
String getBatchletPropertyName2() {
|
||||
return batchletPropertyName2;
|
||||
}
|
||||
|
||||
String getAnnotationNamedProperty() {
|
||||
return annotationNamedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedProperty() {
|
||||
return notDefinedProperty;
|
||||
}
|
||||
|
||||
String getNotDefinedAnnotationNamedProperty() {
|
||||
return notDefinedAnnotationNamedProperty;
|
||||
}
|
||||
}
|
||||
|
||||
public static class InjectTestObj {
|
||||
|
||||
@@ -41,9 +41,11 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="testReader" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemReader"/>
|
||||
<bean id="testReader" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemReader"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testWriter" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemWriter"/>
|
||||
<bean id="testWriter" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemWriter"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testProcessor" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertySubstitutionTests$TestItemProcessor"
|
||||
scope="step"/>
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
<properties>
|
||||
<property name="jobPropertyName1" value="jobPropertyValue1"/>
|
||||
<property name="jobPropertyName2" value="jobPropertyValue2"/>
|
||||
<property name="step2name" value="step2"/>
|
||||
</properties>
|
||||
|
||||
<step id="step1">
|
||||
<step id="step1" allow-start-if-complete="#{jobParameters['allow.start.if.complete']}">
|
||||
<!-- JSR Section 8.2.3 -->
|
||||
<properties>
|
||||
<property name="step1PropertyName1" value="step1PropertyValue1"/>
|
||||
@@ -26,6 +27,7 @@
|
||||
<properties>
|
||||
<property name="readerPropertyName1" value="readerPropertyValue1"/>
|
||||
<property name="readerPropertyName2" value="readerPropertyValue2"/>
|
||||
<property name="readerPropertyName3" value="#{jobParameters['shouldNotBeParsedByPostProcessor']}"/>
|
||||
<property name="annotationNamedReaderPropertyName" value="annotationNamedReaderPropertyValue"/>
|
||||
<property name="nonexistentReaderPropertyName" value="nonexistentReaderPropertyValue"/>
|
||||
</properties>
|
||||
@@ -58,16 +60,16 @@
|
||||
</properties>
|
||||
</checkpoint-algorithm>
|
||||
</chunk>
|
||||
<next on="*" to="stepDecider"/>
|
||||
<next on="*" to="#{jobParameters['deciderName']}#{jobParameters['deciderNumber']}"/>
|
||||
</step>
|
||||
<decision id="stepDecider" ref="testDecider">
|
||||
<decision id="stepDecider1" ref="testDecider">
|
||||
<properties>
|
||||
<property name="deciderPropertyName1" value="deciderPropertyValue1"/>
|
||||
<property name="deciderPropertyName2" value="deciderPropertyValue2"/>
|
||||
<property name="annotationNamedDeciderPropertyName" value="annotationNamedDeciderPropertyValue"/>
|
||||
<property name="nonexistentDeciderPropertyName" value="nonexistentDeciderPropertyValue"/>
|
||||
</properties>
|
||||
<next on="*" to="step2"/>
|
||||
<next on="*" to="#{jobProperties['step2name']}"/>
|
||||
</decision>
|
||||
<step id="step2">
|
||||
<!-- JSR Section 8.2.3 -->
|
||||
@@ -106,20 +108,37 @@
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="testReader" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemReader"/>
|
||||
<bean id="testReader" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemReader"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testProcessor" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemProcessor"/>
|
||||
<bean id="testProcessor" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemProcessor"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testWriter" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemWriter"/>
|
||||
<bean id="testWriter" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestItemWriter"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testCheckpointAlgorithm" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestCheckpointAlgorithm"/>
|
||||
<bean id="testCheckpointAlgorithm" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestCheckpointAlgorithm"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testBatchlet" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestBatchlet"/>
|
||||
<bean id="testBatchlet" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestBatchlet"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testStepListener" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestStepListener"/>
|
||||
<bean id="testStepListener" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestStepListener"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="testDecider" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestDecider"/>
|
||||
<bean id="testDecider" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$TestDecider"
|
||||
scope="step"/>
|
||||
|
||||
<bean id="injectTestObj" class="org.springframework.batch.core.jsr.configuration.xml.JobPropertyTests$InjectTestObj"
|
||||
c:name="Chris"/>
|
||||
|
||||
<bean id="threadLocalClassloaderBeanPostProcessor" class="org.springframework.batch.core.jsr.configuration.support.ThreadLocalClassloaderBeanPostProcessor">
|
||||
<constructor-arg>
|
||||
<props>
|
||||
<prop key="allow.start.if.complete">true</prop>
|
||||
<prop key="deciderName">stepDecider</prop>
|
||||
<prop key="deciderNumber">1</prop>
|
||||
</props>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user