Revert adding a JobRegistryBPP in the default batch configuration
Related to #4245
This commit is contained in:
@@ -22,7 +22,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
|
||||
import org.springframework.batch.core.configuration.support.DefaultJobLoader;
|
||||
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
|
||||
import org.springframework.batch.core.configuration.support.MapJobRegistry;
|
||||
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.launch.support.JobOperatorFactoryBean;
|
||||
@@ -62,7 +61,6 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
registerJobExplorer(registry, batchAnnotation, importingClassName);
|
||||
registerJobLauncher(registry, batchAnnotation, importingClassName);
|
||||
registerJobRegistry(registry);
|
||||
registerJobRegistryBeanPostProcessor(registry);
|
||||
registerJobOperator(registry, batchAnnotation);
|
||||
registerAutomaticJobRegistrar(registry, batchAnnotation);
|
||||
watch.stop();
|
||||
@@ -212,19 +210,6 @@ class BatchRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
registry.registerBeanDefinition("jobRegistry", beanDefinition);
|
||||
}
|
||||
|
||||
private void registerJobRegistryBeanPostProcessor(BeanDefinitionRegistry registry) {
|
||||
if (registry.containsBeanDefinition("jobRegistryBeanPostProcessor")) {
|
||||
LOGGER.info("Bean jobRegistryBeanPostProcessor already defined in the application context, skipping"
|
||||
+ " the registration of a jobRegistryBeanPostProcessor");
|
||||
return;
|
||||
}
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(JobRegistryBeanPostProcessor.class);
|
||||
beanDefinitionBuilder.addPropertyReference("jobRegistry", "jobRegistry");
|
||||
|
||||
registry.registerBeanDefinition("jobRegistryBeanPostProcessor", beanDefinitionBuilder.getBeanDefinition());
|
||||
}
|
||||
|
||||
private void registerJobOperator(BeanDefinitionRegistry registry, EnableBatchProcessing batchAnnotation) {
|
||||
if (registry.containsBeanDefinition("jobOperator")) {
|
||||
LOGGER.info("Bean jobOperator already defined in the application context, skipping"
|
||||
|
||||
@@ -91,10 +91,6 @@ import org.springframework.context.annotation.Import;
|
||||
* <li>a {@link org.springframework.batch.core.launch.JobOperator} (bean name
|
||||
* "jobOperator" of type
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleJobOperator})</li>
|
||||
* <li>a
|
||||
* {@link org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor}
|
||||
* (bean name "jobRegistryBeanPostProcessor" of type
|
||||
* {@link org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor})</li>
|
||||
* </ul>
|
||||
*
|
||||
* If the configuration is specified as <code>modular=true</code>, the context also
|
||||
|
||||
@@ -76,7 +76,6 @@ import org.springframework.transaction.annotation.Isolation;
|
||||
* <li>a {@link JobLauncher} named "jobLauncher"</li>
|
||||
* <li>a {@link JobRegistry} named "jobRegistry"</li>
|
||||
* <li>a {@link JobOperator} named "JobOperator"</li>
|
||||
* <li>a {@link JobRegistryBeanPostProcessor} named "jobRegistryBeanPostProcessor"</li>
|
||||
* <li>a {@link org.springframework.batch.core.scope.StepScope} named "stepScope"</li>
|
||||
* <li>a {@link org.springframework.batch.core.scope.JobScope} named "jobScope"</li>
|
||||
* </ul>
|
||||
@@ -202,19 +201,6 @@ public class DefaultBatchConfiguration implements ApplicationContextAware {
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor() throws BatchConfigurationException {
|
||||
JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor = new JobRegistryBeanPostProcessor();
|
||||
jobRegistryBeanPostProcessor.setJobRegistry(jobRegistry());
|
||||
try {
|
||||
jobRegistryBeanPostProcessor.afterPropertiesSet();
|
||||
return jobRegistryBeanPostProcessor;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new BatchConfigurationException("Unable to configure the default job registry BeanPostProcessor", e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Getters to customize the configuration of infrastructure beans
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user