Commit Graph

2208 Commits

Author SHA1 Message Date
Spring Builds
83ef59ac5e [artifactory-release] Next development version 2022-09-21 18:35:32 +00:00
Spring Builds
ba7cad4ad8 [artifactory-release] Release version 5.0.0-M6 2022-09-21 18:35:29 +00:00
Mahmoud Ben Hassine
219fee3bad Update documentation 2022-09-21 19:51:08 +02:00
Mahmoud Ben Hassine
1141975470 Add isolationLevelForCreate attribute in EnableBatchProcessing
Related to #3942
2022-09-21 19:08:55 +02:00
Mahmoud Ben Hassine
e33659cae5 Add support to customize transaction attributes in infrastructure beans
Before this commit, the transaction attributes were hardcoded and not
configurable in the proxy created by Job explorer/repository/operator
factory beans.

This commit adds the possibility to customize the transaction attributes
in addition to the transaction manager. It is now possible to configure
the transaction's isolation level as well as its propagation for each
method if needed.

Resolves #4195
2022-09-21 10:20:57 +02:00
Mahmoud Ben Hassine
6ad3596401 Add support for transaction customization in SimpleJobOperator
This commit adds support to configure and create a transactional
proxy around SimpleJobOperator through a factory bean.

The usage of `@Transactional` was removed in favor of
the programmatic way of customizing the proxy through
the factory bean.

Resolves #1078
2022-09-21 04:34:34 +02:00
Mahmoud Ben Hassine
40b4be3c14 Add transaction support in JobExplorerFactoryBean
This commit adds support to create a transactional
proxy around the JobExplorer created by the
JobExplorerFactoryBean.

Resolves #1307
2022-09-21 03:28:59 +02:00
Mahmoud Ben Hassine
aaf22e1860 Remove bean reference checks in BatchRegistrar
These checks occur too early in the bean creation/registration
process and might cause issues when initializing the context.

Related to #3942
2022-09-20 15:35:31 +02:00
Mahmoud Ben Hassine
48e437ae17 Revisit the configuration code of EnableBatchProcessing
Before this commit, the configuration of infrastructure beans
was confusing and not straightforward to customize. This commit
changes the way Batch infrastructure beans are configured.
The most important changes are:

* EnableBatchProcessing now provides new attributes to
configure properties of infrastructure beans
* Bean registration is now done programmatically with a
BeanDefinitionRegistrar instead of importing a class with
statically annotated bean definition methods
* Bean are now resolved from the application context directly
instead of being resolved from a BatchConfigurer
* Both a data source and a transaction manager are now
required to be defined in the application context
* A new configuration class called DefaultBatchConfiguration
with default infrastructure bean definitions is now provided
and can be extended to customize the default configuration

Resolves #3942
2022-09-20 12:24:10 +02:00
Mahmoud Ben Hassine
f39f07075a Improve Step/Job builder APIs to guide users to set mandatory properties
Before this commit, the user had to manually set the job repository and transaction
manager on `JobBuilder` and `StepBuilder` instances with a chained call to
`.repository(jobRepository)` and `.transactionManager(transactionManager)`.
This is error prone and can lead to runtime errors if these properties are not set.

This commit introduces new APIs to guide the user to set these properties at
builder creation time.

Resolves #4192
2022-09-17 22:31:12 +02:00
Mahmoud Ben Hassine
d11b5b2c3a Remove BatchConfigurer#getTransactionManager
Before this commit, the transaction manager was configurable
by implementing `BatchConfigurer#getTransactionManager`.

The transaction manager being an implementation detail of the
`JobRepository`, it should not be configurable at the same level
as the `JobRepository` (ie in the same interface).

This commit removes the method `getTransactionManager` from
the `BatchConfigurer` interface. If needed, a custom transaction
manager could be supplied by implementing `getJobRepository`,
or via the constructor of `DefaultBatchConfigurer`.

Resolves https://github.com/spring-projects/spring-batch/issues/4191
2022-09-13 20:02:32 +02:00
Mahmoud Ben Hassine
6e443cb1b1 Deprecate Job/Step builder factories
This commit deprecates JobBuilderFactory and StepBuilderFactory
in favor of the respective builders they create.

It also removes the exposure of such utilities as beans in the
application context when using `@EnableBatchProcessing`.

Resolves https://github.com/spring-projects/spring-batch/issues/4188
2022-09-13 16:56:01 +02:00
Mahmoud Ben Hassine
06c2dc3a01 Refine contribution #4187
Add resource hints for all supported databases
2022-09-12 07:41:14 +02:00
Glenn Renfro
2f8668d1f8 Add native hints for Spring Batch
Issue #4187
2022-09-12 07:36:14 +02:00
Tommy Ludwig
f20942e368 Adapt to ObservationConvention location change
See https://github.com/micrometer-metrics/micrometer/pull/3387
2022-09-09 15:41:45 +02:00
Mahmoud Ben Hassine
7c8fb172a7 Move the transaction manager configuration to AbstractTaskletStepBuilder
Before this commit, the transaction manager was configurable
at the StepBuilder level, which is inconsistent with the XML
config style in addition to be not needed for most step types.

This commit moves the configuration of the transaction manager
from the StepBuilder down to the AbstractTaskletStepBuilder,
which is the level where the transaction manager is needed.

Resolves #4130
2022-09-08 11:35:14 +02:00
Mahmoud Ben Hassine
4d548d9a49 Exclude junit-jupiter from micrometer test dependencies 2022-09-07 17:05:06 +02:00
Mahmoud Ben Hassine
bd25df6770 Put back "Fix StepScopeProxyTargetClassOverrideIntegrationTests"
Related to bbf7086765.
2022-08-24 20:07:21 +02:00
Spring Builds
878578f829 [artifactory-release] Next development version 2022-08-24 17:14:59 +00:00
Spring Builds
7fc0af6785 [artifactory-release] Release version 5.0.0-M5 2022-08-24 17:14:56 +00:00
Mahmoud Ben Hassine
bbf7086765 Revert "Fix StepScopeProxyTargetClassOverrideIntegrationTests"
This reverts commit bf2e6ab0e5
as the change was made after spring-framework 6.0.0-M5 was
released. This version is required to release spring-batch
5.0.0-M5

This change will be put back after releasing 5.0.0-M5.
2022-08-24 18:11:18 +02:00
Henning Poettker
6bbd9d8379 Fix non-nullable columns in MySQL migration for Spring Batch 4.3
Issue #4145
2022-08-24 15:57:46 +02:00
Mahmoud Ben Hassine
c425137eec Remove datasource dependency in JobRepositoryTestUtils
Before this commit, the `JobRepositoryTestUtils` was
tied to the JDBC implementation of the `JobRepository`
as it was requiring a datasource. This makes it unusable
with implementations that do not rely on a datasource
to store batch meta-data (A MongoDB job repository for
instance where no datasource is used).

This commit decouples the `JobRepositoryTestUtils` from
the implementation details of the `JobRepository` by making
it working against the `JobRepository` interface.

This commit also introduces the necessary methods in the
`JobRepository` interface as well as various DAOs to
implement the utilities without having to deal with the
details of the underlying repository implementation.

Resolves #4070
2022-08-23 21:33:06 +02:00
Mahmoud Ben Hassine
fe40370f39 Refine contribution #4167
The documentation generation change introduced
in #4167 seems to scan more files than previously
WRT checking the code formatting style.

This commit fixes the formatting of the files
that do not conform to the Spring style.
2022-08-21 09:52:35 +02:00
Mahmoud Ben Hassine
e67c0069f1 Use the Chunk API consistently
This commit replaces the usage of List with Chunk
where appropriate. Summary of changes:

- The Chunk class was moved from the `org.springframework.batch.core.step.item` package to the `org.springframework.batch.item` package
- The signature of the method `ItemWriter#write(List)` was changed to `ItemWriter#write(Chunk)`
- All implementations of `ItemWriter` were updated to use the Chunk API instead of List
- All methods in the `ItemWriteListener` interface were updated to use the Chunk API instead of List
- All implementations of `ItemWriteListener` were updated to use the Chunk API instead of List
- The constructor of `ChunkRequest` was changed to accept a Chunk instead of a Collection of items
- The return type of `ChunkRequest#getItems()` was changed from List to Chunk

Resolves #3954
2022-08-19 13:40:09 +02:00
Mahmoud Ben Hassine
bf2e6ab0e5 Fix StepScopeProxyTargetClassOverrideIntegrationTests
This test started failing after an upstream change in Spring Framework,
see https://github.com/spring-projects/spring-framework/issues/28115
2022-08-16 11:49:30 +02:00
Mahmoud Ben Hassine
9211c2d211 Make MessageChannelPartitionHandler extend AbstractPartitionHandler 2022-08-03 10:52:36 +02:00
Henning Poettker
2fdb68d28e Migrate Spring Batch Core to JUnit Jupiter 2022-08-02 21:25:54 +02:00
Mahmoud Ben Hassine
4cb15ca837 Fix breaking changes in micrometer APIs
Related to https://github.com/micrometer-metrics/micrometer/pull/3310
2022-07-27 15:31:18 +02:00
Mahmoud Ben Hassine
96c6367dae Replace KeyValuesProvider with ObservationConvention
Related to https://github.com/micrometer-metrics/micrometer/pull/3306
2022-07-26 06:55:39 +02:00
Glenn Renfro
ee7d12671b Updated Batch Metrics to use DefaultMeterObservationHandler
instead of TimerObservationHandler
2022-07-21 11:32:35 +02:00
Spring Builds
08adb4550a [artifactory-release] Next development version 2022-07-21 03:17:06 +00:00
Spring Builds
d46aeef01d [artifactory-release] Release version 5.0.0-M4 2022-07-21 03:17:03 +00:00
Fadhel Mahmoud Ben Hassine
d328e43948 Fix Javadoc errors 2022-07-21 04:47:59 +02:00
Taeik Lim
ed945ca61d Add @FunctionalInterface where appropriate
Resolves #4107
2022-07-20 19:05:36 +02:00
Taeik Lim
8b6343fc8f Add missing initialized flag set to FlowJob
Issue #4142
2022-07-20 18:49:15 +02:00
Jay Bryant
1af645505c Editing pass
for grammar, spelling, consistency and (most importantly) clarity.
2022-07-20 18:32:05 +02:00
Jay Bryant
61ea236ce0 Javadoc editing
for grammar, punctuation, usage, and (sometimes) missing content.
2022-07-20 18:24:13 +02:00
Jay Bryant
e6e21c5e18 Improve Javadocs 2022-07-20 18:15:28 +02:00
Fadhel Mahmoud Ben Hassine
310c280e40 Override methods from SimpleJobLauncher in TaskExecutorJobLauncher
This commit is to prevent usage of deprecated APIs
inherited from SimpleJobLauncher
2022-07-19 18:19:17 +02:00
Fadhel Mahmoud Ben Hassine
08e04817d1 Refine #4131
* Deprecate SimpleJobLauncher in favor of TaskExecutorJobLauncher
* Update year in license headers
2022-07-19 13:58:22 +02:00
Marvin Deng
c0791039dc Rename SimpleJobLauncher to TaskExecutorJobLauncher
Resolves #4123
2022-07-19 13:34:23 +02:00
Henning Pöttker
d280556d02 Let fluent setters of SimpleStepBuilder return proper type
Let fluent setters of `SimpleStepBuilder` return `this` with type `SimpleStepBuilder`.
This makes the required order of some fluent setters a bit more lenient and prevents
that `AbstractTaskletStepBuilder::listener` for parameters of type `Object` is invoked
although an overloaded method specific for `SimpleStepBuilder` is intended.

Fixes #773 and #1098.
2022-07-19 13:20:57 +02:00
Fadhel Mahmoud Ben Hassine
8fef41bd76 Rename BatchStepTagsProvider to BatchStepKeyValuesProvider
This rename is for consistency with
BatchJobKeyValuesProvider

Related to a19eefa7fd
2022-07-19 12:43:23 +02:00
Jonatan Ivanov
9b3b899360 Remove *Aware interfaces from Micrometer 2022-07-18 18:07:13 -07:00
Mahmoud Ben Hassine
565ddcdf96 Change transaction manager type in default batch configuration
This commits changes the type of the transaction manager
from `DataSourceTransactionManager` to `JdbcTransactionManager`
in the default configuration of `@EnableBatchProcessing`.

The `JdbcTransactionManager` adds common JDBC exception translation
which is beneficial for Spring Batch to improve exception handling
and error reporting.

Resolves #4126
2022-07-16 17:52:43 +02:00
Henning Poettker
3ef199b92b Reduce use of deprecated APIs 2022-07-16 00:17:46 +02:00
Henning Poettker
451db9a968 Fix tests catching nested exceptions
These tests started failing after an upstream
change in Spring Framework [1].

[1]: https://github.com/spring-projects/spring-framework/issues/25162
2022-07-16 00:06:42 +02:00
Mahmoud Ben Hassine
b89ea8e789 Fix tests related to infrastructure beans configuration
These tests seem to start failing since 31af573 but were
not caught due to #4121. This commit fixes the tests that
are related to infrastructure beans configuration.

Some other tests seems to have started failing as well but
are not related to this change set. There were temporarily
ignored in this commit and will be addressed separately.

Issue #4121
2022-07-13 05:30:37 +02:00
Mahmoud Ben Hassine
c65b93f707 Add non null assertions in Job/Step builder factories 2022-07-12 19:27:22 +02:00