Skip to content

Commit a34a464

Browse files
committed
Make ModularBatchConfiguration extend SimpleBatchConfiguration
This change makes the added value of ModularBatchConfiguration compared to SimpleBatchConfiguration more visible.
1 parent 31af573 commit a34a464

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/ModularBatchConfiguration.java

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,19 @@
3030
import org.springframework.transaction.PlatformTransactionManager;
3131

3232
/**
33-
* Base {@code Configuration} class providing common structure for enabling and using Spring Batch. Customization is
34-
* available by implementing the {@link BatchConfigurer} interface.
33+
* Base {@code Configuration} class providing common structure for enabling and using Spring Batch.
34+
* Customization is available by implementing the {@link BatchConfigurer} interface.
3535
*
3636
* @author Dave Syer
3737
* @author Mahmoud Ben Hassine
3838
* @since 2.2
3939
* @see EnableBatchProcessing
4040
*/
4141
@Configuration(proxyBeanMethods = false)
42-
public class ModularBatchConfiguration extends AbstractBatchConfiguration {
43-
44-
@Autowired
45-
private ApplicationContext context;
46-
47-
@Autowired(required = false)
48-
private Collection<BatchConfigurer> configurers;
42+
public class ModularBatchConfiguration extends SimpleBatchConfiguration {
4943

5044
private AutomaticJobRegistrar registrar = new AutomaticJobRegistrar();
5145

52-
@Override
53-
@Bean
54-
public JobRepository jobRepository() throws Exception {
55-
return getConfigurer(configurers).getJobRepository();
56-
}
57-
58-
@Override
59-
@Bean
60-
public JobLauncher jobLauncher() throws Exception {
61-
return getConfigurer(configurers).getJobLauncher();
62-
}
63-
64-
@Override
65-
public PlatformTransactionManager transactionManager() throws Exception {
66-
return getConfigurer(configurers).getTransactionManager();
67-
}
68-
69-
@Override
70-
@Bean
71-
public JobExplorer jobExplorer() throws Exception {
72-
return getConfigurer(configurers).getJobExplorer();
73-
}
74-
7546
/**
7647
* Creates a {@link AutomaticJobRegistrar} bean.
7748
*

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
public class SimpleBatchConfiguration extends AbstractBatchConfiguration {
4848

4949
@Autowired
50-
private ApplicationContext context;
50+
protected ApplicationContext context;
5151

5252
@Autowired(required = false)
5353
private Collection<BatchConfigurer> configurers;

0 commit comments

Comments
 (0)