mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge pull request #34437 from fmbenhassine
* pr/34437: Update Batch documentation Closes gh-34437
This commit is contained in:
commit
f5a8a71a10
@ -11,8 +11,9 @@ By default, batch applications require a `DataSource` to store job details.
|
||||
Spring Batch expects a single `DataSource` by default.
|
||||
To have it use a `DataSource` other than the application’s main `DataSource`, declare a `DataSource` bean, annotating its `@Bean` method with `@BatchDataSource`.
|
||||
If you do so and want two data sources, remember to mark the other one `@Primary`.
|
||||
To take greater control, implement `BatchConfigurer`.
|
||||
See {spring-batch-api}/core/configuration/annotation/EnableBatchProcessing.html[The Javadoc of `@EnableBatchProcessing`] for more details.
|
||||
To take greater control, add `@EnableBatchProcessing` to one of your `@Configuration` classes or extend `DefaultBatchConfiguration`.
|
||||
See the Javadoc of {spring-batch-api}/core/configuration/annotation/EnableBatchProcessing.html[`@EnableBatchProcessing`]
|
||||
and {spring-batch-api}/core/configuration/support/DefaultBatchConfiguration.html[`DefaultBatchConfiguration`] for more details.
|
||||
|
||||
For more info about Spring Batch, see the {spring-batch}[Spring Batch project page].
|
||||
|
||||
@ -20,14 +21,14 @@ For more info about Spring Batch, see the {spring-batch}[Spring Batch project pa
|
||||
|
||||
[[howto.batch.running-jobs-on-startup]]
|
||||
=== Running Spring Batch Jobs on Startup
|
||||
Spring Batch auto-configuration is enabled by adding `@EnableBatchProcessing` to one of your `@Configuration` classes.
|
||||
Spring Batch auto-configuration is enabled by adding `spring-boot-starter-batch` to your application's classpath.
|
||||
|
||||
If a single `Job` is found in the application context, it is executed on startup (see {spring-boot-autoconfigure-module-code}/batch/JobLauncherApplicationRunner.java[`JobLauncherApplicationRunner`] for details).
|
||||
If multiple `Job` beans are found, the job that should be executed must be specified using configprop:spring.batch.job.name[].
|
||||
|
||||
To disable running a `Job` found in the application content, set the configprop:spring.batch.job.enabled[] to `false.`
|
||||
|
||||
See {spring-boot-autoconfigure-module-code}/batch/BatchAutoConfiguration.java[BatchAutoConfiguration] and {spring-batch-api}/core/configuration/annotation/EnableBatchProcessing.html[@EnableBatchProcessing] for more details.
|
||||
See {spring-boot-autoconfigure-module-code}/batch/BatchAutoConfiguration.java[BatchAutoConfiguration] for more details.
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user