Update javadocs

This commit is contained in:
Mahmoud Ben Hassine
2025-06-11 15:10:52 +02:00
parent e35c87ccdd
commit 4fbac1f9e5
6 changed files with 60 additions and 17 deletions

View File

@@ -24,7 +24,11 @@ import org.springframework.batch.core.converter.JobParametersConverter;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>
@@ -36,7 +40,6 @@ import java.lang.annotation.*;
* <pre class="code">
* &#064;Configuration
* &#064;EnableBatchProcessing
* &#064;Import(DataSourceConfiguration.class)
* public class AppConfig {
*
* &#064;Bean
@@ -72,18 +75,18 @@ import java.lang.annotation.*;
*
* <ul>
* <li>a {@link JobRepository} (bean name "jobRepository" of type
* {@link org.springframework.batch.core.repository.support.SimpleJobRepository})</li>
* {@link org.springframework.batch.core.repository.support.ResourcelessJobRepository})</li>
* <li>a {@link JobRegistry} (bean name "jobRegistry" of type
* {@link org.springframework.batch.core.configuration.support.MapJobRegistry})</li>
* <li>a {@link org.springframework.batch.core.launch.JobOperator} (bean name
* "jobOperator" of type
* {@link org.springframework.batch.core.launch.support.TaskExecutorJobOperator})</li>
* <li>a
* {@link org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton}
* (bean name "jobRegistrySmartInitializingSingleton" of type
* {@link org.springframework.batch.core.configuration.support.JobRegistrySmartInitializingSingleton})</li>
* </ul>
*
* Other configuration types like JDBC-based or MongoDB-based batch infrastructures can be
* defined using store specific annotations like {@link EnableJdbcJobRepository} or
* {@link EnableMongoJobRepository}.
*
* If the configuration is specified as <code>modular=true</code>, the context also
* contains an {@link AutomaticJobRegistrar}. The job registrar is useful for modularizing
* your configuration if there are multiple jobs. It works by creating separate child
@@ -141,7 +144,8 @@ import java.lang.annotation.*;
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @author Taeik Lim
*
* @see EnableJdbcJobRepository
* @see EnableMongoJobRepository
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)

View File

@@ -17,6 +17,8 @@ package org.springframework.batch.core.configuration.annotation;
import org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao;
import org.springframework.batch.support.DatabaseType;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.annotation.Isolation;
@@ -27,6 +29,23 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.sql.Types;
import javax.sql.DataSource;
/**
* Annotation to enable a JDBC-based infrastructure in a Spring Batch application.
* <p>
* This annotation should be used on a {@link Configuration @Configuration} class
* annotated with {@link EnableBatchProcessing }. It will automatically configure the
* necessary beans for a JDBC-based infrastructure, including a job repository.
* <p>
* The default configuration assumes that a {@link DataSource} bean named "dataSource" and
* a {@link DataSourceTransactionManager} bean named "transactionManager" are available in
* the application context.
*
* @author Mahmoud Ben Hassine
* @since 6.0
* @see EnableBatchProcessing
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@@ -62,13 +81,15 @@ public @interface EnableJdbcJobRepository {
String charset() default "UTF-8";
/**
* The Batch tables prefix. Defaults to {@literal "BATCH_"}.
* The Batch tables prefix. Defaults to
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_TABLE_PREFIX}.
* @return the Batch table prefix
*/
String tablePrefix() default AbstractJdbcBatchMetadataDao.DEFAULT_TABLE_PREFIX;
/**
* The maximum length of exit messages in the database.
* The maximum length of exit messages in the database. Defaults to
* {@link AbstractJdbcBatchMetadataDao#DEFAULT_EXIT_MESSAGE_LENGTH}
* @return the maximum length of exit messages in the database
*/
int maxVarCharLength() default AbstractJdbcBatchMetadataDao.DEFAULT_EXIT_MESSAGE_LENGTH;
@@ -92,6 +113,11 @@ public @interface EnableJdbcJobRepository {
*/
String transactionManagerRef() default "transactionManager";
/**
* Set the {@link JdbcOperations} to use in the job repository.
* @return the bean name of the {@link JdbcOperations} to use. Defaults to
* {@literal jdbcTemplate}.
*/
String jdbcOperationsRef() default "jdbcTemplate";
/**

View File

@@ -15,7 +15,9 @@
*/
package org.springframework.batch.core.configuration.annotation;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoTransactionManager;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.transaction.annotation.Isolation;
import java.lang.annotation.Documented;
@@ -24,6 +26,21 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* * Annotation to enable a MongoDB-based job repository in a Spring Batch application.
* <p>
* This annotation should be used on a {@link Configuration @Configuration} class
* annotated with {@link EnableBatchProcessing}. It will automatically configure the
* necessary beans for a MongoDB-based infrastructure, including a job repository.
* <p>
* The default configuration assumes that a {@link MongoOperations} bean named
* "mongoTemplate" and a {@link MongoTransactionManager} bean named "transactionManager"
* are available in the application context.
*
* @author Mahmoud Ben Hassine
* @since 6.0
* @see EnableBatchProcessing
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented

View File

@@ -49,7 +49,7 @@ import org.springframework.transaction.annotation.Isolation;
* <ul>
* <li>a {@link ResourcelessJobRepository} named "jobRepository"</li>
* <li>a {@link MapJobRegistry} named "jobRegistry"</li>
* <li>a {@link TaskExecutorJobOperator} named "JobOperator"</li>
* <li>a {@link TaskExecutorJobOperator} named "jobOperator"</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>

View File

@@ -62,9 +62,7 @@ import java.sql.Types;
* <ul>
* <li>a {@link JobRepository} named "jobRepository"</li>
* <li>a {@link JobRegistry} named "jobRegistry"</li>
* <li>a {@link JobOperator} named "JobOperator"</li>
* <li>a {@link JobRegistrySmartInitializingSingleton} named
* "jobRegistrySmartInitializingSingleton"</li>
* <li>a {@link JobOperator} named "jobOperator"</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>

View File

@@ -35,9 +35,7 @@ import org.springframework.data.mongodb.core.MongoOperations;
* <ul>
* <li>a {@link JobRepository} named "jobRepository"</li>
* <li>a {@link JobRegistry} named "jobRegistry"</li>
* <li>a {@link JobOperator} named "JobOperator"</li>
* <li>a {@link JobRegistrySmartInitializingSingleton} named
* "jobRegistrySmartInitializingSingleton"</li>
* <li>a {@link JobOperator} named "jobOperator"</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>