Update documentation with expected configuration to use @SpringBatchTest
Resolves #3699
This commit is contained in:
@@ -34,6 +34,16 @@ Starting from v4.1, it is also possible to inject Spring Batch test utilities
|
||||
like the `JobLauncherTestUtils` and `JobRepositoryTestUtils` in the test context
|
||||
using the `@SpringBatchTest` annotation.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
It should be noted that `JobLauncherTestUtils` requires a `Job` bean and that
|
||||
`JobRepositoryTestUtils` requires a `DataSource` bean. Since `@SpringBatchTest`
|
||||
registers a `JobLauncherTestUtils` and a `JobRepositoryTestUtils` in the test
|
||||
context, it is expected that the test context contains a single autowire candidate
|
||||
for a `Job` and a `DataSource` (either a single bean definition or one that is
|
||||
annotated with `org.springframework.context.annotation.Primary`).
|
||||
====
|
||||
|
||||
[role="javaContent"]
|
||||
The following Java example shows the annotations in use:
|
||||
|
||||
|
||||
@@ -116,6 +116,19 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
*
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p><strong>
|
||||
* It should be noted that {@link JobLauncherTestUtils} requires a
|
||||
* {@link org.springframework.batch.core.Job} bean and that
|
||||
* {@link JobRepositoryTestUtils} requires a {@link javax.sql.DataSource} bean.
|
||||
* Since this annotation registers a {@link JobLauncherTestUtils} and a
|
||||
* {@link JobRepositoryTestUtils} in the test context, it is expected that the
|
||||
* test context contains a single autowire candidate for a
|
||||
* {@link org.springframework.batch.core.Job} and a {@link javax.sql.DataSource}
|
||||
* (either a single bean definition or one that is
|
||||
* annotated with {@link org.springframework.context.annotation.Primary}).
|
||||
* </strong></p>
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 4.1
|
||||
* @see JobLauncherTestUtils
|
||||
|
||||
Reference in New Issue
Block a user