Skip to content

Commit 4fbac1f

Browse files
committed
Update javadocs
1 parent e35c87c commit 4fbac1f

File tree

6 files changed

+60
-17
lines changed

6 files changed

+60
-17
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
import org.springframework.batch.core.repository.JobRepository;
2525
import org.springframework.context.annotation.Import;
2626

27-
import java.lang.annotation.*;
27+
import java.lang.annotation.Documented;
28+
import java.lang.annotation.ElementType;
29+
import java.lang.annotation.Retention;
30+
import java.lang.annotation.RetentionPolicy;
31+
import java.lang.annotation.Target;
2832

2933
/**
3034
* <p>
@@ -36,7 +40,6 @@
3640
* <pre class="code">
3741
* &#064;Configuration
3842
* &#064;EnableBatchProcessing
39-
* &#064;Import(DataSourceConfiguration.class)
4043
* public class AppConfig {
4144
*
4245
* &#064;Bean
@@ -72,18 +75,18 @@
7275
*
7376
* <ul>
7477
* <li>a {@link JobRepository} (bean name "jobRepository" of type
75-
* {@link org.springframework.batch.core.repository.support.SimpleJobRepository})</li>
78+
* {@link org.springframework.batch.core.repository.support.ResourcelessJobRepository})</li>
7679
* <li>a {@link JobRegistry} (bean name "jobRegistry" of type
7780
* {@link org.springframework.batch.core.configuration.support.MapJobRegistry})</li>
7881
* <li>a {@link org.springframework.batch.core.launch.JobOperator} (bean name
7982
* "jobOperator" of type
8083
* {@link org.springframework.batch.core.launch.support.TaskExecutorJobOperator})</li>
81-
* <li>a
82-
* {@link org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton}
83-
* (bean name "jobRegistrySmartInitializingSingleton" of type
84-
* {@link org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton})</li>
8584
* </ul>
8685
*
86+
* Other configuration types like JDBC-based or MongoDB-based batch infrastructures can be
87+
* defined using store specific annotations like {@link EnableJdbcJobRepository} or
88+
* {@link EnableMongoJobRepository}.
89+
*
8790
* If the configuration is specified as <code>modular=true</code>, the context also
8891
* contains an {@link AutomaticJobRegistrar}. The job registrar is useful for modularizing
8992
* your configuration if there are multiple jobs. It works by creating separate child
@@ -141,7 +144,8 @@
141144
* @author Dave Syer
142145
* @author Mahmoud Ben Hassine
143146
* @author Taeik Lim
144-
*
147+
* @see EnableJdbcJobRepository
148+
* @see EnableMongoJobRepository
145149
*/
146150
@Target(ElementType.TYPE)
147151
@Retention(RetentionPolicy.RUNTIME)

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

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao;
1919
import org.springframework.batch.support.DatabaseType;
20+
import org.springframework.context.annotation.Configuration;
21+
import org.springframework.jdbc.core.JdbcOperations;
2022
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
2123
import org.springframework.transaction.annotation.Isolation;
2224

@@ -27,6 +29,23 @@
2729
import java.lang.annotation.Target;
2830
import java.sql.Types;
2931

32+
import javax.sql.DataSource;
33+
34+
/**
35+
* Annotation to enable a JDBC-based infrastructure in a Spring Batch application.
36+
* <p>
37+
* This annotation should be used on a {@link Configuration @Configuration} class
38+
* annotated with {@link EnableBatchProcessing }. It will automatically configure the
39+
* necessary beans for a JDBC-based infrastructure, including a job repository.
40+
* <p>
41+
* The default configuration assumes that a {@link DataSource} bean named "dataSource" and
42+
* a {@link DataSourceTransactionManager} bean named "transactionManager" are available in
43+
* the application context.
44+
*
45+
* @author Mahmoud Ben Hassine
46+
* @since 6.0
47+
* @see EnableBatchProcessing
48+
*/
3049
@Target(ElementType.TYPE)
3150
@Retention(RetentionPolicy.RUNTIME)
3251
@Documented
@@ -62,13 +81,15 @@
6281
String charset() default "UTF-8";
6382

6483
/**
65-
* The Batch tables prefix. Defaults to {@literal "BATCH_"}.
84+
* The Batch tables prefix. Defaults to
85+
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_TABLE_PREFIX}.
6686
* @return the Batch table prefix
6787
*/
6888
String tablePrefix() default AbstractJdbcBatchMetadataDao.DEFAULT_TABLE_PREFIX;
6989

7090
/**
71-
* The maximum length of exit messages in the database.
91+
* The maximum length of exit messages in the database. Defaults to
92+
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_EXIT_MESSAGE_LENGTH}
7293
* @return the maximum length of exit messages in the database
7394
*/
7495
int maxVarCharLength() default AbstractJdbcBatchMetadataDao.DEFAULT_EXIT_MESSAGE_LENGTH;
@@ -92,6 +113,11 @@
92113
*/
93114
String transactionManagerRef() default "transactionManager";
94115

116+
/**
117+
* Set the {@link JdbcOperations} to use in the job repository.
118+
* @return the bean name of the {@link JdbcOperations} to use. Defaults to
119+
* {@literal jdbcTemplate}.
120+
*/
95121
String jdbcOperationsRef() default "jdbcTemplate";
96122

97123
/**

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package org.springframework.batch.core.configuration.annotation;
1717

18+
import org.springframework.context.annotation.Configuration;
1819
import org.springframework.data.mongodb.MongoTransactionManager;
20+
import org.springframework.data.mongodb.core.MongoOperations;
1921
import org.springframework.transaction.annotation.Isolation;
2022

2123
import java.lang.annotation.Documented;
@@ -24,6 +26,21 @@
2426
import java.lang.annotation.RetentionPolicy;
2527
import java.lang.annotation.Target;
2628

29+
/**
30+
* * Annotation to enable a MongoDB-based job repository in a Spring Batch application.
31+
* <p>
32+
* This annotation should be used on a {@link Configuration @Configuration} class
33+
* annotated with {@link EnableBatchProcessing}. It will automatically configure the
34+
* necessary beans for a MongoDB-based infrastructure, including a job repository.
35+
* <p>
36+
* The default configuration assumes that a {@link MongoOperations} bean named
37+
* "mongoTemplate" and a {@link MongoTransactionManager} bean named "transactionManager"
38+
* are available in the application context.
39+
*
40+
* @author Mahmoud Ben Hassine
41+
* @since 6.0
42+
* @see EnableBatchProcessing
43+
*/
2744
@Target(ElementType.TYPE)
2845
@Retention(RetentionPolicy.RUNTIME)
2946
@Documented

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/DefaultBatchConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* <ul>
5050
* <li>a {@link ResourcelessJobRepository} named "jobRepository"</li>
5151
* <li>a {@link MapJobRegistry} named "jobRegistry"</li>
52-
* <li>a {@link TaskExecutorJobOperator} named "JobOperator"</li>
52+
* <li>a {@link TaskExecutorJobOperator} named "jobOperator"</li>
5353
* <li>a {@link org.springframework.batch.core.scope.StepScope} named "stepScope"</li>
5454
* <li>a {@link org.springframework.batch.core.scope.JobScope} named "jobScope"</li>
5555
* </ul>

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JdbcDefaultBatchConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262
* <ul>
6363
* <li>a {@link JobRepository} named "jobRepository"</li>
6464
* <li>a {@link JobRegistry} named "jobRegistry"</li>
65-
* <li>a {@link JobOperator} named "JobOperator"</li>
66-
* <li>a {@link JobRegistrySmartInitializingSingleton} named
67-
* "jobRegistrySmartInitializingSingleton"</li>
65+
* <li>a {@link JobOperator} named "jobOperator"</li>
6866
* <li>a {@link org.springframework.batch.core.scope.StepScope} named "stepScope"</li>
6967
* <li>a {@link org.springframework.batch.core.scope.JobScope} named "jobScope"</li>
7068
* </ul>

spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MongoDefaultBatchConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
* <ul>
3636
* <li>a {@link JobRepository} named "jobRepository"</li>
3737
* <li>a {@link JobRegistry} named "jobRegistry"</li>
38-
* <li>a {@link JobOperator} named "JobOperator"</li>
39-
* <li>a {@link JobRegistrySmartInitializingSingleton} named
40-
* "jobRegistrySmartInitializingSingleton"</li>
38+
* <li>a {@link JobOperator} named "jobOperator"</li>
4139
* <li>a {@link org.springframework.batch.core.scope.StepScope} named "stepScope"</li>
4240
* <li>a {@link org.springframework.batch.core.scope.JobScope} named "jobScope"</li>
4341
* </ul>

0 commit comments

Comments
 (0)