Upgrade spring-javaformat maven plugin to version 0.0.39
This commit is contained in:
@@ -98,15 +98,15 @@ public class CoreRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
// proxy hints
|
||||
hints.proxies()
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.repository.JobRepository"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class))
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.explore.JobExplorer"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class))
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.launch.JobOperator"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class));
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.repository.JobRepository"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class))
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.explore.JobExplorer"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class))
|
||||
.registerJdkProxy(builder -> builder
|
||||
.proxiedInterfaces(TypeReference.of("org.springframework.batch.core.launch.JobOperator"))
|
||||
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class));
|
||||
|
||||
// reflection hints
|
||||
hints.reflection().registerType(Types.class, MemberCategory.DECLARED_FIELDS);
|
||||
@@ -122,8 +122,9 @@ public class CoreRuntimeHints implements RuntimeHintsRegistrar {
|
||||
hints.reflection().registerType(Entity.class, MemberCategory.values());
|
||||
hints.reflection().registerType(ExecutionContext.class, MemberCategory.values());
|
||||
hints.reflection().registerType(Chunk.class, MemberCategory.values());
|
||||
jdkTypes.stream().map(TypeReference::of)
|
||||
.forEach(type -> hints.reflection().registerType(type, MemberCategory.values()));
|
||||
jdkTypes.stream()
|
||||
.map(TypeReference::of)
|
||||
.forEach(type -> hints.reflection().registerType(type, MemberCategory.values()));
|
||||
|
||||
// serialization hints
|
||||
SerializationHints serializationHints = hints.serialization();
|
||||
@@ -135,7 +136,7 @@ public class CoreRuntimeHints implements RuntimeHintsRegistrar {
|
||||
Period.class, HashMap.class, Hashtable.class, ArrayList.class, JobParameter.class, JobParameters.class,
|
||||
ExitStatus.class, JobInstance.class, JobExecution.class, StepExecution.class, StepContribution.class,
|
||||
Entity.class, ExecutionContext.class, Chunk.class, Properties.class, Exception.class, UUID.class)
|
||||
.forEach(serializationHints::registerType);
|
||||
.forEach(serializationHints::registerType);
|
||||
jdkTypes.stream().map(TypeReference::of).forEach(serializationHints::registerType);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class AutomaticJobRegistrarBeanPostProcessor implements BeanFactoryPostProcessor
|
||||
AutomaticJobRegistrar automaticJobRegistrar = (AutomaticJobRegistrar) bean;
|
||||
automaticJobRegistrar.setJobLoader(new DefaultJobLoader(this.beanFactory.getBean(JobRegistry.class)));
|
||||
for (ApplicationContextFactory factory : this.beanFactory.getBeansOfType(ApplicationContextFactory.class)
|
||||
.values()) {
|
||||
.values()) {
|
||||
automaticJobRegistrar.addApplicationContextFactory(factory);
|
||||
}
|
||||
return automaticJobRegistrar;
|
||||
|
||||
@@ -54,8 +54,9 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
validateState(importingClassMetadata);
|
||||
EnableBatchProcessing batchAnnotation = importingClassMetadata.getAnnotations().get(EnableBatchProcessing.class)
|
||||
.synthesize();
|
||||
EnableBatchProcessing batchAnnotation = importingClassMetadata.getAnnotations()
|
||||
.get(EnableBatchProcessing.class)
|
||||
.synthesize();
|
||||
registerJobRepository(registry, batchAnnotation);
|
||||
registerJobExplorer(registry, batchAnnotation);
|
||||
registerJobLauncher(registry, batchAnnotation);
|
||||
@@ -82,7 +83,7 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(JobRepositoryFactoryBean.class);
|
||||
.genericBeanDefinition(JobRepositoryFactoryBean.class);
|
||||
|
||||
// set mandatory properties
|
||||
String dataSourceRef = batchAnnotation.dataSourceRef();
|
||||
@@ -139,7 +140,7 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(JobExplorerFactoryBean.class);
|
||||
.genericBeanDefinition(JobExplorerFactoryBean.class);
|
||||
|
||||
// set mandatory properties
|
||||
String dataSourceRef = batchAnnotation.dataSourceRef();
|
||||
@@ -183,7 +184,7 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(TaskExecutorJobLauncher.class);
|
||||
.genericBeanDefinition(TaskExecutorJobLauncher.class);
|
||||
// set mandatory properties
|
||||
beanDefinitionBuilder.addPropertyReference("jobRepository", "jobRepository");
|
||||
|
||||
@@ -202,7 +203,7 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(MapJobRegistry.class)
|
||||
.getBeanDefinition();
|
||||
.getBeanDefinition();
|
||||
registry.registerBeanDefinition("jobRegistry", beanDefinition);
|
||||
}
|
||||
|
||||
@@ -213,7 +214,7 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(JobOperatorFactoryBean.class);
|
||||
.genericBeanDefinition(JobOperatorFactoryBean.class);
|
||||
// set mandatory properties
|
||||
String transactionManagerRef = batchAnnotation.transactionManagerRef();
|
||||
beanDefinitionBuilder.addPropertyReference("transactionManager", transactionManagerRef);
|
||||
@@ -236,11 +237,13 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
return;
|
||||
}
|
||||
BeanDefinition jobLoaderBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(DefaultJobLoader.class)
|
||||
.addPropertyReference("jobRegistry", "jobRegistry").getBeanDefinition();
|
||||
.addPropertyReference("jobRegistry", "jobRegistry")
|
||||
.getBeanDefinition();
|
||||
registry.registerBeanDefinition("jobLoader", jobLoaderBeanDefinition);
|
||||
BeanDefinition jobRegistrarBeanDefinition = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(AutomaticJobRegistrar.class).addPropertyReference("jobLoader", "jobLoader")
|
||||
.getBeanDefinition();
|
||||
.genericBeanDefinition(AutomaticJobRegistrar.class)
|
||||
.addPropertyReference("jobLoader", "jobLoader")
|
||||
.getBeanDefinition();
|
||||
registry.registerBeanDefinition("jobRegistrar", jobRegistrarBeanDefinition);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Taeik Lim
|
||||
*
|
||||
* @since 3.0.1
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Taeik Lim
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -203,7 +203,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
|
||||
String flowName = (String) builder.getRawBeanDefinition().getAttribute("flowName");
|
||||
if (!stepExists && !StringUtils.hasText(element.getAttribute("parent"))) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The flow [" + flowName + "] must contain at least one step, flow or split", element);
|
||||
.error("The flow [" + flowName + "] must contain at least one step, flow or split", element);
|
||||
}
|
||||
|
||||
// Ensure that all elements are reachable
|
||||
@@ -326,8 +326,9 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
|
||||
}
|
||||
}
|
||||
else if (hasNextAttribute) {
|
||||
parserContext.getReaderContext().error("The <" + element.getNodeName() + "/> may not contain a '"
|
||||
+ NEXT_ATTR + "' attribute and a transition element", element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> may not contain a '" + NEXT_ATTR
|
||||
+ "' attribute and a transition element", element);
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -345,8 +346,8 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
|
||||
ParserContext parserContext) {
|
||||
String onAttribute = transitionElement.getAttribute(ON_ATTR);
|
||||
if (patterns.contains(onAttribute)) {
|
||||
parserContext.getReaderContext().error("Duplicate transition pattern found for '" + onAttribute + "'",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("Duplicate transition pattern found for '" + onAttribute + "'", element);
|
||||
}
|
||||
patterns.add(onAttribute);
|
||||
}
|
||||
@@ -398,7 +399,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
|
||||
if (status.isEnd()) {
|
||||
|
||||
BeanDefinitionBuilder endBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.EndState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.EndState");
|
||||
|
||||
boolean exitCodeExists = StringUtils.hasText(exitCode);
|
||||
|
||||
@@ -477,7 +478,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
|
||||
BeanDefinition stateDefinition, String on, String next) {
|
||||
|
||||
BeanDefinitionBuilder nextBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.StateTransition");
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.StateTransition");
|
||||
nextBuilder.addConstructorArgValue(stateDefinition);
|
||||
|
||||
if (StringUtils.hasText(on)) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class AbstractListenerParser {
|
||||
else if (beanElements.size() == 1) {
|
||||
Element beanElement = beanElements.get(0);
|
||||
BeanDefinitionHolder beanDefinitionHolder = parserContext.getDelegate()
|
||||
.parseBeanDefinitionElement(beanElement, enclosing);
|
||||
.parseBeanDefinitionElement(beanElement, enclosing);
|
||||
parserContext.getDelegate().decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
|
||||
return beanDefinitionHolder;
|
||||
}
|
||||
@@ -120,9 +120,9 @@ public abstract class AbstractListenerParser {
|
||||
|
||||
String id = element.getAttribute(ID_ATTR);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getTagName() + (StringUtils.hasText(id) ? " id=\"" + id + "\"" : "")
|
||||
+ "/> element must have exactly one of: '" + REF_ATTR + "' attribute, <" + BEAN_ELE
|
||||
+ "/> attribute, or <" + REF_ELE + "/> element. Found: " + found + ".", element);
|
||||
.error("The <" + element.getTagName() + (StringUtils.hasText(id) ? " id=\"" + id + "\"" : "")
|
||||
+ "/> element must have exactly one of: '" + REF_ATTR + "' attribute, <" + BEAN_ELE
|
||||
+ "/> attribute, or <" + REF_ELE + "/> element. Found: " + found + ".", element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ public abstract class AbstractStepParser {
|
||||
if ((ns == null && name.equals(BeanDefinitionParserDelegate.BEAN_ELEMENT))
|
||||
|| ns.equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
|
||||
BeanDefinitionHolder holder = parserContext.getDelegate()
|
||||
.parseBeanDefinitionElement(nestedElement);
|
||||
.parseBeanDefinitionElement(nestedElement);
|
||||
value = parserContext.getDelegate().decorateBeanDefinitionIfRequired(nestedElement, holder);
|
||||
}
|
||||
// Spring Batch transitions
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ChunkElementParser {
|
||||
if (commitInterval.startsWith("#")) {
|
||||
// It's a late binding expression, so we need step scope...
|
||||
BeanDefinitionBuilder completionPolicy = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(SimpleCompletionPolicy.class);
|
||||
.genericBeanDefinition(SimpleCompletionPolicy.class);
|
||||
completionPolicy.addConstructorArgValue(commitInterval);
|
||||
completionPolicy.setScope("step");
|
||||
propertyValues.addPropertyValue("chunkCompletionPolicy", completionPolicy.getBeanDefinition());
|
||||
@@ -114,16 +114,13 @@ public class ChunkElementParser {
|
||||
&& propertyValues.contains("commitInterval") == propertyValues.contains("chunkCompletionPolicy")) {
|
||||
if (propertyValues.contains("commitInterval")) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> element must contain either '"
|
||||
+ COMMIT_INTERVAL_ATTR + "' " + "or '" + CHUNK_COMPLETION_POLICY_ATTR
|
||||
+ "', but not both.", element);
|
||||
.error("The <" + element.getNodeName() + "/> element must contain either '" + COMMIT_INTERVAL_ATTR
|
||||
+ "' " + "or '" + CHUNK_COMPLETION_POLICY_ATTR + "', but not both.", element);
|
||||
}
|
||||
else {
|
||||
parserContext
|
||||
.getReaderContext().error(
|
||||
"The <" + element.getNodeName() + "/> element must contain either '"
|
||||
+ COMMIT_INTERVAL_ATTR + "' " + "or '" + CHUNK_COMPLETION_POLICY_ATTR + "'.",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> element must contain either '" + COMMIT_INTERVAL_ATTR
|
||||
+ "' " + "or '" + CHUNK_COMPLETION_POLICY_ATTR + "'.", element);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -214,23 +211,24 @@ public class ChunkElementParser {
|
||||
if (children.size() == 1) {
|
||||
if (StringUtils.hasText(refName)) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> element may not have both a '" + handlerName
|
||||
+ "' attribute and a <" + handlerName + "/> element.", element);
|
||||
.error("The <" + element.getNodeName() + "/> element may not have both a '" + handlerName
|
||||
+ "' attribute and a <" + handlerName + "/> element.", element);
|
||||
}
|
||||
handleItemHandlerElement(enclosing, propertyName, adapterClassName, propertyValues, children.get(0),
|
||||
parserContext);
|
||||
}
|
||||
else if (children.size() > 1) {
|
||||
parserContext.getReaderContext().error("The <" + handlerName
|
||||
+ "/> element may not appear more than once in a single <" + element.getNodeName() + "/>.",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + handlerName + "/> element may not appear more than once in a single <"
|
||||
+ element.getNodeName() + "/>.", element);
|
||||
}
|
||||
else if (StringUtils.hasText(refName)) {
|
||||
propertyValues.addPropertyValue(propertyName, new RuntimeBeanReference(refName));
|
||||
}
|
||||
else if (required && !underspecified) {
|
||||
parserContext.getReaderContext().error("The <" + element.getNodeName() + "/> element has neither a '"
|
||||
+ handlerName + "' attribute nor a <" + handlerName + "/> element.", element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> element has neither a '" + handlerName
|
||||
+ "' attribute nor a <" + handlerName + "/> element.", element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,13 +243,13 @@ public class ChunkElementParser {
|
||||
List<Element> refElements = DomUtils.getChildElementsByTagName(element, REF_ELE);
|
||||
if (beanElements.size() + refElements.size() != 1) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + element.getNodeName() + "/> must have exactly one of either a <" + BEAN_ELE
|
||||
+ "/> element or a <" + REF_ELE + "/> element.", element);
|
||||
.error("The <" + element.getNodeName() + "/> must have exactly one of either a <" + BEAN_ELE
|
||||
+ "/> element or a <" + REF_ELE + "/> element.", element);
|
||||
}
|
||||
else if (beanElements.size() == 1) {
|
||||
Element beanElement = beanElements.get(0);
|
||||
BeanDefinitionHolder beanDefinitionHolder = parserContext.getDelegate()
|
||||
.parseBeanDefinitionElement(beanElement, enclosing);
|
||||
.parseBeanDefinitionElement(beanElement, enclosing);
|
||||
parserContext.getDelegate().decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
|
||||
|
||||
propertyValues.addPropertyValue(propertyName, beanDefinitionHolder);
|
||||
@@ -330,8 +328,9 @@ public class ChunkElementParser {
|
||||
streamBeans.add(new RuntimeBeanReference(streamRef));
|
||||
}
|
||||
else {
|
||||
parserContext.getReaderContext().error(
|
||||
REF_ATTR + " not specified for <" + streamElement.getTagName() + "> element", element);
|
||||
parserContext.getReaderContext()
|
||||
.error(REF_ATTR + " not specified for <" + streamElement.getTagName() + "> element",
|
||||
element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ public class CoreNamespaceUtils {
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
if (!stateTransitionComparatorAlreadyDefined(registry)) {
|
||||
AbstractBeanDefinition defaultStateTransitionComparator = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(DefaultStateTransitionComparator.class).getBeanDefinition();
|
||||
.genericBeanDefinition(DefaultStateTransitionComparator.class)
|
||||
.getBeanDefinition();
|
||||
registry.registerBeanDefinition(DefaultStateTransitionComparator.STATE_TRANSITION_COMPARATOR,
|
||||
defaultStateTransitionComparator);
|
||||
}
|
||||
@@ -126,7 +127,8 @@ public class CoreNamespaceUtils {
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
if (!rangeArrayEditorAlreadyDefined(registry)) {
|
||||
AbstractBeanDefinition customEditorConfigurer = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(CUSTOM_EDITOR_CONFIGURER_CLASS_NAME).getBeanDefinition();
|
||||
.genericBeanDefinition(CUSTOM_EDITOR_CONFIGURER_CLASS_NAME)
|
||||
.getBeanDefinition();
|
||||
customEditorConfigurer.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
ManagedMap<String, String> editors = new ManagedMap<>();
|
||||
editors.put(RANGE_ARRAY_CLASS_NAME, RANGE_ARRAY_EDITOR_CLASS_NAME);
|
||||
@@ -167,7 +169,8 @@ public class CoreNamespaceUtils {
|
||||
BeanDefinitionRegistry registry = parserContext.getRegistry();
|
||||
if (!coreNamespaceBeanPostProcessorAlreadyDefined(registry)) {
|
||||
AbstractBeanDefinition postProcessorBeanDef = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME).getBeanDefinition();
|
||||
.genericBeanDefinition(CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME)
|
||||
.getBeanDefinition();
|
||||
postProcessorBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
registry.registerBeanDefinition(CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME, postProcessorBeanDef);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DecisionParser {
|
||||
String idAttribute = element.getAttribute("id");
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.DecisionState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.DecisionState");
|
||||
stateBuilder.addConstructorArgValue(new RuntimeBeanReference(refAttribute));
|
||||
stateBuilder.addConstructorArgValue(idAttribute);
|
||||
return InlineFlowParser.getNextElements(parserContext, stateBuilder.getBeanDefinition(), element);
|
||||
|
||||
@@ -38,9 +38,9 @@ public class ExceptionElementParser {
|
||||
return map;
|
||||
}
|
||||
else if (children.size() > 1) {
|
||||
parserContext.getReaderContext().error("The <" + exceptionListName
|
||||
+ "/> element may not appear more than once in a single <" + element.getNodeName() + "/>.",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + exceptionListName + "/> element may not appear more than once in a single <"
|
||||
+ element.getNodeName() + "/>.", element);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class FlowElementParser {
|
||||
String idAttribute = element.getAttribute(ID_ATTR);
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.FlowState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.FlowState");
|
||||
|
||||
AbstractBeanDefinition flowDefinition = new GenericBeanDefinition();
|
||||
flowDefinition.setParentName(refAttribute);
|
||||
|
||||
@@ -67,11 +67,10 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
|
||||
if (!CoreNamespaceUtils.namespaceMatchesVersion(element)) {
|
||||
parserContext.getReaderContext().error(
|
||||
"You are using a version of the spring-batch XSD that is not compatible with Spring Batch 3.0."
|
||||
+ " Please upgrade your schema declarations (or use the spring-batch.xsd alias if you are "
|
||||
+ "feeling lucky).",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("You are using a version of the spring-batch XSD that is not compatible with Spring Batch 3.0."
|
||||
+ " Please upgrade your schema declarations (or use the spring-batch.xsd alias if you are "
|
||||
+ "feeling lucky).", element);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,9 +110,9 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
if (isAbstract) {
|
||||
for (String tagName : Arrays.asList("step", "decision", "split")) {
|
||||
if (!DomUtils.getChildElementsByTagName(element, tagName).isEmpty()) {
|
||||
parserContext.getReaderContext().error("The <" + tagName
|
||||
+ "/> element may not appear on a <job/> with abstract=\"true\" [" + jobName + "]",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + tagName + "/> element may not appear on a <job/> with abstract=\"true\" ["
|
||||
+ jobName + "]", element);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +145,7 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
else if (listenersElements.size() > 1) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The '<listeners/>' element may not appear more than once in a single <job/>.", element);
|
||||
.error("The '<listeners/>' element may not appear more than once in a single <job/>.", element);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,7 +166,7 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
else if (beanElement != null) {
|
||||
BeanDefinitionHolder beanDefinitionHolder = parserContext.getDelegate()
|
||||
.parseBeanDefinitionElement(beanElement);
|
||||
.parseBeanDefinitionElement(beanElement);
|
||||
parserContext.getDelegate().decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
|
||||
return beanDefinitionHolder;
|
||||
}
|
||||
@@ -176,7 +175,7 @@ public class JobParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
|
||||
parserContext.getReaderContext()
|
||||
.error("One of ref attribute or a nested bean definition or ref element must be specified", element);
|
||||
.error("One of ref attribute or a nested bean definition or ref element must be specified", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SplitParser {
|
||||
String idAttribute = element.getAttribute("id");
|
||||
|
||||
BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.SplitState");
|
||||
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.SplitState");
|
||||
|
||||
String taskExecutorBeanId = element.getAttribute("task-executor");
|
||||
if (StringUtils.hasText(taskExecutorBeanId)) {
|
||||
@@ -91,8 +91,8 @@ public class SplitParser {
|
||||
String ref = nextElement.getAttribute(PARENT_ATTR);
|
||||
if (StringUtils.hasText(ref)) {
|
||||
if (nextElement.getElementsByTagName("*").getLength() > 0) {
|
||||
parserContext.getReaderContext().error(
|
||||
"A <flow/> in a <split/> must have ref= or nested <flow/>, but not both.", nextElement);
|
||||
parserContext.getReaderContext()
|
||||
.error("A <flow/> in a <split/> must have ref= or nested <flow/>, but not both.", nextElement);
|
||||
}
|
||||
AbstractBeanDefinition flowDefinition = new GenericBeanDefinition();
|
||||
flowDefinition.setParentName(ref);
|
||||
|
||||
@@ -290,7 +290,8 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
|
||||
PartitionStepBuilder builder;
|
||||
if (partitioner != null) {
|
||||
builder = new StepBuilder(name, jobRepository)
|
||||
.partitioner(step != null ? step.getName() : name, partitioner).step(step);
|
||||
.partitioner(step != null ? step.getName() : name, partitioner)
|
||||
.step(step);
|
||||
}
|
||||
else {
|
||||
builder = new StepBuilder(name, jobRepository).partitioner(step);
|
||||
|
||||
@@ -90,13 +90,13 @@ public class TaskletParser {
|
||||
else if (beanElements.size() == 1) {
|
||||
Element beanElement = beanElements.get(0);
|
||||
BeanDefinitionHolder beanDefinitionHolder = parserContext.getDelegate()
|
||||
.parseBeanDefinitionElement(beanElement, bd);
|
||||
.parseBeanDefinitionElement(beanElement, bd);
|
||||
parserContext.getDelegate().decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
|
||||
bme = beanDefinitionHolder;
|
||||
}
|
||||
else if (refElements.size() == 1) {
|
||||
bme = (BeanMetadataElement) parserContext.getDelegate().parsePropertySubElement(refElements.get(0),
|
||||
null);
|
||||
bme = (BeanMetadataElement) parserContext.getDelegate()
|
||||
.parsePropertySubElement(refElements.get(0), null);
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(taskletMethod)) {
|
||||
@@ -168,9 +168,9 @@ public class TaskletParser {
|
||||
|
||||
if (error != null) {
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + taskletElement.getTagName() + "/> element " + error + " one of: '"
|
||||
+ TASKLET_REF_ATTR + "' attribute, <" + CHUNK_ELE + "/> element, <" + BEAN_ELE
|
||||
+ "/> attribute, or <" + REF_ELE + "/> element. Found: " + found + ".", taskletElement);
|
||||
.error("The <" + taskletElement.getTagName() + "/> element " + error + " one of: '" + TASKLET_REF_ATTR
|
||||
+ "' attribute, <" + CHUNK_ELE + "/> element, <" + BEAN_ELE + "/> attribute, or <" + REF_ELE
|
||||
+ "/> element. Found: " + found + ".", taskletElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ public class TaskletParser {
|
||||
propertyValues.addPropertyValue(propertyName, list);
|
||||
}
|
||||
else if (children.size() > 1) {
|
||||
parserContext.getReaderContext().error("The <" + exceptionListName
|
||||
+ "/> element may not appear more than once in a single <" + element.getNodeName() + "/>.",
|
||||
element);
|
||||
parserContext.getReaderContext()
|
||||
.error("The <" + exceptionListName + "/> element may not appear more than once in a single <"
|
||||
+ element.getNodeName() + "/>.", element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public abstract class AbstractJobExplorerFactoryBean implements FactoryBean<JobE
|
||||
transactionAttributes.setProperty("find*", transactionProperties);
|
||||
this.transactionAttributeSource = new NameMatchTransactionAttributeSource();
|
||||
((NameMatchTransactionAttributeSource) this.transactionAttributeSource)
|
||||
.setProperties(transactionAttributes);
|
||||
.setProperties(transactionAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -297,10 +297,11 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
execution.getJobInstance().getJobName()));
|
||||
LongTaskTimer.Sample longTaskTimerSample = longTaskTimer.start();
|
||||
Observation observation = BatchMetrics
|
||||
.createObservation(BatchJobObservation.BATCH_JOB_OBSERVATION.getName(), new BatchJobContext(execution),
|
||||
this.observationRegistry)
|
||||
.contextualName(execution.getJobInstance().getJobName())
|
||||
.observationConvention(this.observationConvention).start();
|
||||
.createObservation(BatchJobObservation.BATCH_JOB_OBSERVATION.getName(), new BatchJobContext(execution),
|
||||
this.observationRegistry)
|
||||
.contextualName(execution.getJobInstance().getJobName())
|
||||
.observationConvention(this.observationConvention)
|
||||
.start();
|
||||
try (Observation.Scope scope = observation.openScope()) {
|
||||
|
||||
jobParametersValidator.validate(execution.getJobParameters());
|
||||
@@ -358,7 +359,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
&& execution.getStepExecutions().isEmpty()) {
|
||||
ExitStatus exitStatus = execution.getExitStatus();
|
||||
ExitStatus newExitStatus = ExitStatus.NOOP
|
||||
.addExitDescription("All steps already completed or no steps configured for this job.");
|
||||
.addExitDescription("All steps already completed or no steps configured for this job.");
|
||||
execution.setExitStatus(exitStatus.and(newExitStatus));
|
||||
}
|
||||
stopObservation(execution, observation);
|
||||
|
||||
@@ -193,7 +193,7 @@ public class CommandLineJobRunner {
|
||||
private JobRepository jobRepository;
|
||||
|
||||
private final static List<String> VALID_OPTS = Arrays
|
||||
.asList(new String[] { "-restart", "-next", "-stop", "-abandon" });
|
||||
.asList(new String[] { "-restart", "-next", "-stop", "-abandon" });
|
||||
|
||||
/**
|
||||
* Injection setter for the {@link JobLauncher}.
|
||||
@@ -297,8 +297,8 @@ public class CommandLineJobRunner {
|
||||
context = new ClassPathXmlApplicationContext(jobPath);
|
||||
}
|
||||
|
||||
context.getAutowireCapableBeanFactory().autowireBeanProperties(this,
|
||||
AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
|
||||
context.getAutowireCapableBeanFactory()
|
||||
.autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
|
||||
|
||||
Assert.state(launcher != null, "A JobLauncher must be provided. Please add one to the configuration.");
|
||||
if (opts.contains("-restart") || opts.contains("-next")) {
|
||||
@@ -309,7 +309,7 @@ public class CommandLineJobRunner {
|
||||
String jobName = jobIdentifier;
|
||||
|
||||
JobParameters jobParameters = jobParametersConverter
|
||||
.getJobParameters(StringUtils.splitArrayElementsIntoProperties(parameters, "="));
|
||||
.getJobParameters(StringUtils.splitArrayElementsIntoProperties(parameters, "="));
|
||||
Assert.isTrue(parameters == null || parameters.length == 0 || !jobParameters.isEmpty(),
|
||||
"Invalid JobParameters " + Arrays.asList(parameters)
|
||||
+ ". If parameters are provided they should be in the form name=value (no whitespace).");
|
||||
@@ -362,7 +362,7 @@ public class CommandLineJobRunner {
|
||||
|
||||
if (opts.contains("-next")) {
|
||||
jobParameters = new JobParametersBuilder(jobParameters, jobExplorer).getNextJobParameters(job)
|
||||
.toJobParameters();
|
||||
.toJobParameters();
|
||||
}
|
||||
|
||||
JobExecution jobExecution = launcher.run(job, jobParameters);
|
||||
|
||||
@@ -52,7 +52,8 @@ public class DataFieldMaxValueJobParametersIncrementer implements JobParametersI
|
||||
@Override
|
||||
public JobParameters getNext(JobParameters jobParameters) {
|
||||
return new JobParametersBuilder(jobParameters == null ? new JobParameters() : jobParameters)
|
||||
.addLong(this.key, this.dataFieldMaxValueIncrementer.nextLongValue()).toJobParameters();
|
||||
.addLong(this.key, this.dataFieldMaxValueIncrementer.nextLongValue())
|
||||
.toJobParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -262,8 +262,8 @@ public class JobRegistryBackgroundJobRunner {
|
||||
|
||||
private void run() {
|
||||
final ApplicationContext parent = new ClassPathXmlApplicationContext(parentContextPath);
|
||||
parent.getAutowireCapableBeanFactory().autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE,
|
||||
false);
|
||||
parent.getAutowireCapableBeanFactory()
|
||||
.autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
|
||||
parent.getAutowireCapableBeanFactory().initializeBean(this, getClass().getSimpleName());
|
||||
this.parentContext = parent;
|
||||
}
|
||||
|
||||
@@ -339,8 +339,8 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
|
||||
Job job = jobRegistry.getJob(jobName);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(
|
||||
String.format("Attempting to launch job with name=%s and parameters={%s}", jobName, parameters));
|
||||
logger
|
||||
.info(String.format("Attempting to launch job with name=%s and parameters={%s}", jobName, parameters));
|
||||
}
|
||||
try {
|
||||
return jobLauncher.run(job, jobParameters).getId();
|
||||
|
||||
@@ -68,8 +68,10 @@ public final class BatchMetrics {
|
||||
* @return a new timer instance
|
||||
*/
|
||||
public static Timer createTimer(MeterRegistry meterRegistry, String name, String description, Tag... tags) {
|
||||
return Timer.builder(METRICS_PREFIX + name).description(description).tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
return Timer.builder(METRICS_PREFIX + name)
|
||||
.description(description)
|
||||
.tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,8 +84,10 @@ public final class BatchMetrics {
|
||||
* @return a new timer instance
|
||||
*/
|
||||
public static Counter createCounter(MeterRegistry meterRegistry, String name, String description, Tag... tags) {
|
||||
return Counter.builder(METRICS_PREFIX + name).description(description).tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
return Counter.builder(METRICS_PREFIX + name)
|
||||
.description(description)
|
||||
.tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,8 +144,10 @@ public final class BatchMetrics {
|
||||
*/
|
||||
public static LongTaskTimer createLongTaskTimer(MeterRegistry meterRegistry, String name, String description,
|
||||
Tag... tags) {
|
||||
return LongTaskTimer.builder(METRICS_PREFIX + name).description(description).tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
return LongTaskTimer.builder(METRICS_PREFIX + name)
|
||||
.description(description)
|
||||
.tags(Arrays.asList(tags))
|
||||
.register(meterRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,7 @@ public class DefaultBatchJobObservationConvention implements BatchJobObservation
|
||||
return KeyValues.of(
|
||||
BatchJobObservation.JobLowCardinalityTags.JOB_NAME.withValue(execution.getJobInstance().getJobName()),
|
||||
BatchJobObservation.JobLowCardinalityTags.JOB_STATUS
|
||||
.withValue(execution.getExitStatus().getExitCode()));
|
||||
.withValue(execution.getExitStatus().getExitCode()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,9 +42,9 @@ public class DefaultBatchJobObservationConvention implements BatchJobObservation
|
||||
JobExecution execution = context.getJobExecution();
|
||||
return KeyValues.of(
|
||||
BatchJobObservation.JobHighCardinalityTags.JOB_INSTANCE_ID
|
||||
.withValue(String.valueOf(execution.getJobInstance().getInstanceId())),
|
||||
.withValue(String.valueOf(execution.getJobInstance().getInstanceId())),
|
||||
BatchJobObservation.JobHighCardinalityTags.JOB_EXECUTION_ID
|
||||
.withValue(String.valueOf(execution.getId())));
|
||||
.withValue(String.valueOf(execution.getId())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@ public class DefaultBatchStepObservationConvention implements BatchStepObservati
|
||||
StepExecution execution = context.getStepExecution();
|
||||
return KeyValues.of(BatchStepObservation.StepLowCardinalityTags.STEP_NAME.withValue(execution.getStepName()),
|
||||
BatchStepObservation.StepLowCardinalityTags.JOB_NAME
|
||||
.withValue(execution.getJobExecution().getJobInstance().getJobName()),
|
||||
.withValue(execution.getJobExecution().getJobInstance().getJobName()),
|
||||
BatchStepObservation.StepLowCardinalityTags.STEP_STATUS
|
||||
.withValue(execution.getExitStatus().getExitCode()));
|
||||
.withValue(execution.getExitStatus().getExitCode()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyValues getHighCardinalityKeyValues(BatchStepContext context) {
|
||||
StepExecution execution = context.getStepExecution();
|
||||
return KeyValues.of(BatchStepObservation.StepHighCardinalityTags.STEP_EXECUTION_ID
|
||||
.withValue(String.valueOf(execution.getId())));
|
||||
.withValue(String.valueOf(execution.getId())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,8 +99,10 @@ public class RemoteStepExecutionAggregator implements StepExecutionAggregator, I
|
||||
JobExecution jobExecution = jobExplorer.getJobExecution(result.getJobExecutionId());
|
||||
Assert.state(jobExecution != null,
|
||||
"Could not load JobExecution from JobRepository for id " + result.getJobExecutionId());
|
||||
List<StepExecution> updates = jobExecution.getStepExecutions().stream()
|
||||
.filter(stepExecution -> stepExecutionIds.contains(stepExecution.getId())).collect(Collectors.toList());
|
||||
List<StepExecution> updates = jobExecution.getStepExecutions()
|
||||
.stream()
|
||||
.filter(stepExecution -> stepExecutionIds.contains(stepExecution.getId()))
|
||||
.collect(Collectors.toList());
|
||||
delegate.aggregate(result, updates);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
catch (TaskRejectedException e) {
|
||||
// couldn't execute one of the tasks
|
||||
ExitStatus exitStatus = ExitStatus.FAILED
|
||||
.addExitDescription("TaskExecutor rejected the task for this step.");
|
||||
.addExitDescription("TaskExecutor rejected the task for this step.");
|
||||
/*
|
||||
* Set the status in case the caller is tracking it through the
|
||||
* JobExecution.
|
||||
|
||||
@@ -125,11 +125,13 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
* of trusted classes.
|
||||
*/
|
||||
public Jackson2ExecutionContextStringSerializer(String... trustedClassNames) {
|
||||
this.objectMapper = JsonMapper.builder().configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false)
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
|
||||
.configure(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES, true)
|
||||
.setDefaultTyping(createTrustedDefaultTyping(trustedClassNames)).addModule(new JobParametersModule())
|
||||
.build();
|
||||
this.objectMapper = JsonMapper.builder()
|
||||
.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false)
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
|
||||
.configure(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES, true)
|
||||
.setDefaultTyping(createTrustedDefaultTyping(trustedClassNames))
|
||||
.addModule(new JobParametersModule())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void setObjectMapper(ObjectMapper objectMapper) {
|
||||
@@ -282,21 +284,22 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
*/
|
||||
static class TrustedTypeIdResolver implements TypeIdResolver {
|
||||
|
||||
private static final Set<String> TRUSTED_CLASS_NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
|
||||
"javax.xml.namespace.QName", "java.util.UUID", "java.util.ArrayList", "java.util.Arrays$ArrayList",
|
||||
"java.util.LinkedList", "java.util.Collections$EmptyList", "java.util.Collections$EmptyMap",
|
||||
"java.util.Collections$EmptySet", "java.util.Collections$UnmodifiableRandomAccessList",
|
||||
"java.util.Collections$UnmodifiableList", "java.util.Collections$UnmodifiableMap",
|
||||
"java.util.Collections$UnmodifiableSet", "java.util.Collections$SingletonList",
|
||||
"java.util.Collections$SingletonMap", "java.util.Collections$SingletonSet", "java.util.Date",
|
||||
"java.time.Instant", "java.time.Duration", "java.time.LocalDate", "java.time.LocalTime",
|
||||
"java.time.LocalDateTime", "java.sql.Timestamp", "java.net.URL", "java.util.TreeMap",
|
||||
"java.util.HashMap", "java.util.LinkedHashMap", "java.util.TreeSet", "java.util.HashSet",
|
||||
"java.util.LinkedHashSet", "java.lang.Boolean", "java.lang.Byte", "java.lang.Short",
|
||||
"java.lang.Integer", "java.lang.Long", "java.lang.Double", "java.lang.Float", "java.math.BigDecimal",
|
||||
"java.math.BigInteger", "java.lang.String", "java.lang.Character", "java.lang.CharSequence",
|
||||
"java.util.Properties", "[Ljava.util.Properties;", "org.springframework.batch.core.JobParameter",
|
||||
"org.springframework.batch.core.JobParameters")));
|
||||
private static final Set<String> TRUSTED_CLASS_NAMES = Collections
|
||||
.unmodifiableSet(new HashSet<>(Arrays.asList("javax.xml.namespace.QName", "java.util.UUID",
|
||||
"java.util.ArrayList", "java.util.Arrays$ArrayList", "java.util.LinkedList",
|
||||
"java.util.Collections$EmptyList", "java.util.Collections$EmptyMap",
|
||||
"java.util.Collections$EmptySet", "java.util.Collections$UnmodifiableRandomAccessList",
|
||||
"java.util.Collections$UnmodifiableList", "java.util.Collections$UnmodifiableMap",
|
||||
"java.util.Collections$UnmodifiableSet", "java.util.Collections$SingletonList",
|
||||
"java.util.Collections$SingletonMap", "java.util.Collections$SingletonSet", "java.util.Date",
|
||||
"java.time.Instant", "java.time.Duration", "java.time.LocalDate", "java.time.LocalTime",
|
||||
"java.time.LocalDateTime", "java.sql.Timestamp", "java.net.URL", "java.util.TreeMap",
|
||||
"java.util.HashMap", "java.util.LinkedHashMap", "java.util.TreeSet", "java.util.HashSet",
|
||||
"java.util.LinkedHashSet", "java.lang.Boolean", "java.lang.Byte", "java.lang.Short",
|
||||
"java.lang.Integer", "java.lang.Long", "java.lang.Double", "java.lang.Float",
|
||||
"java.math.BigDecimal", "java.math.BigInteger", "java.lang.String", "java.lang.Character",
|
||||
"java.lang.CharSequence", "java.util.Properties", "[Ljava.util.Properties;",
|
||||
"org.springframework.batch.core.JobParameter", "org.springframework.batch.core.JobParameters")));
|
||||
|
||||
private final Set<String> trustedClassNames = new LinkedHashSet<>(TRUSTED_CLASS_NAMES);
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean<Jo
|
||||
transactionAttributes.setProperty("*", "PROPAGATION_REQUIRED");
|
||||
this.transactionAttributeSource = new NameMatchTransactionAttributeSource();
|
||||
((NameMatchTransactionAttributeSource) this.transactionAttributeSource)
|
||||
.setProperties(transactionAttributes);
|
||||
.setProperties(transactionAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,8 +152,9 @@ public class SimpleJobRepository implements JobRepository {
|
||||
+ "so it may be dangerous to proceed. Manual intervention is probably necessary.");
|
||||
}
|
||||
Collection<JobParameter<?>> allJobParameters = execution.getJobParameters().getParameters().values();
|
||||
long identifyingJobParametersCount = allJobParameters.stream().filter(JobParameter::isIdentifying)
|
||||
.count();
|
||||
long identifyingJobParametersCount = allJobParameters.stream()
|
||||
.filter(JobParameter::isIdentifying)
|
||||
.count();
|
||||
if (identifyingJobParametersCount > 0
|
||||
&& (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED)) {
|
||||
throw new JobInstanceAlreadyCompleteException(
|
||||
|
||||
@@ -209,9 +209,11 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
|
||||
stepExecution.setStartTime(LocalDateTime.now());
|
||||
stepExecution.setStatus(BatchStatus.STARTED);
|
||||
Observation observation = BatchMetrics
|
||||
.createObservation(BatchStepObservation.BATCH_STEP_OBSERVATION.getName(),
|
||||
new BatchStepContext(stepExecution), this.observationRegistry)
|
||||
.contextualName(stepExecution.getStepName()).observationConvention(this.observationConvention).start();
|
||||
.createObservation(BatchStepObservation.BATCH_STEP_OBSERVATION.getName(),
|
||||
new BatchStepContext(stepExecution), this.observationRegistry)
|
||||
.contextualName(stepExecution.getStepName())
|
||||
.observationConvention(this.observationConvention)
|
||||
.start();
|
||||
getJobRepository().update(stepExecution);
|
||||
|
||||
// Start with a default value that will be trumped by anything
|
||||
|
||||
@@ -475,7 +475,7 @@ public class SimpleStepFactoryBean<T, S> implements FactoryBean<Step>, BeanNameA
|
||||
builder.listener(listener);
|
||||
}
|
||||
for (ItemProcessListener<T, S> listener : BatchListenerFactoryHelper
|
||||
.<ItemProcessListener<T, S>>getListeners(listeners, ItemProcessListener.class)) {
|
||||
.<ItemProcessListener<T, S>>getListeners(listeners, ItemProcessListener.class)) {
|
||||
builder.listener(listener);
|
||||
}
|
||||
builder.transactionManager(transactionManager);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class SystemCommandTasklet implements StepExecutionListener, StoppableTas
|
||||
|
||||
if (stoppable) {
|
||||
JobExecution jobExecution = jobExplorer
|
||||
.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId());
|
||||
.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId());
|
||||
|
||||
if (jobExecution.isStopping()) {
|
||||
stopped = true;
|
||||
|
||||
@@ -253,7 +253,7 @@ public class TaskletStep extends AbstractStep {
|
||||
RepeatStatus result;
|
||||
try {
|
||||
result = new TransactionTemplate(transactionManager, transactionAttribute)
|
||||
.execute(new ChunkTransactionCallback(chunkContext, semaphore));
|
||||
.execute(new ChunkTransactionCallback(chunkContext, semaphore));
|
||||
}
|
||||
catch (UncheckedTransactionException e) {
|
||||
// Allow checked exceptions to be thrown inside callback
|
||||
|
||||
Reference in New Issue
Block a user