Commit Graph

807 Commits

Author SHA1 Message Date
Danilo Piazzalunga
fc0ec01ff8 Throw IllegalStateException from afterPropertiesSet
Consistently use Assert.state in the afterPropertiesSet()
methods to throw IllegalStateException instead of
IllegalArgumentException when some properties are missing
and/or invalid.

Resolves #2244
2022-11-23 12:22:26 +01:00
Mahmoud Ben Hassine
05bbd3f7ea Remove dependency autowiring in test utilities
Issue #4233
2022-11-16 14:21:17 +01:00
Henning Poettker
3bb7ce532b Improve @SpringBatchTest to autowire the job under test in JobLauncherTestUtils if it is unique
Issue #4218
2022-11-08 13:16:36 +01:00
Mahmoud Ben Hassine
2660f2bb27 Add support to use any type as a job parameter
This commit also changes the way job parameters
are parsed and persisted.

NB: This commit should ideally have been split
into two change sets. But the changes are tightly
related that is was not possible to separate them.

Related to:

* https://github.com/spring-projects/spring-batch/issues/3960
* https://github.com/spring-projects/spring-batch/issues/2122
* https://github.com/spring-projects/spring-batch/issues/1035
* https://github.com/spring-projects/spring-batch/issues/1983
2022-10-04 20:35:50 +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
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
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
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
4d0ed63dd7 Deprecate AssertFile
Resolves #4181
2022-08-24 15:17:34 +02:00
Mahmoud Ben Hassine
7e535afb73 Refine contribution #4112
Revert the removal of `@SpringJUnitConfig`
usage in the test suite of samples.

Related to #4111
2022-08-24 10:37:02 +02:00
Glenn Renfro
8ca9802da4 Remove the JUnit dependency in AssertFile
The side effect is a breaking change in that it will now
throw IllegalStateException instead of the Compare and
AssertExceptions provided by JUnit.

Resolves #4111
2022-08-24 10:29:45 +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
c506a49988 Remove job autowiring in JobLauncherTestUtils
Before this commit, registering the JobLauncherTestUtils
as a bean in the test context (either manually or via
`@SpringBatchTest`) was failing when multiple jobs are
defined in the test context.

This commit removes the autowiring of the job under test
in JobLauncherTestUtils.

Resolves #1237
2022-08-20 12:39:02 +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
Henning Poettker
1e4a23e3eb Migrate Spring Batch Samples to JUnit Jupiter 2022-08-02 17:18:12 +02:00
Henning Poettker
a393dc533d Replace deprecated IntegrationFlows 2022-07-20 18:28:34 +02:00
Marvin Deng
c0791039dc Rename SimpleJobLauncher to TaskExecutorJobLauncher
Resolves #4123
2022-07-19 13:34:23 +02:00
Henning Poettker
a55f556893 Use Hibernate mapping DTD from classpath 2022-07-18 12:45:06 +02: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
Mahmoud Ben Hassine
c4ad90b9b1 Apply spring-javaformat style for consistency with other projects
Resolves #4118
2022-05-25 23:06:48 +02:00
Mahmoud Ben Hassine
984570a1b1 Rename schema-oracle10g.sql to schema-oracle.sql
Resolves ##1057
2022-03-22 17:29:59 +01:00
Mahmoud Ben Hassine
968a5b5b2e Refine contribution #595
- Update versions of jdbc driver and docker image
- Update Javadocs
- Remove JOB_CONFIGURATION_LOCATION from DDL schema
- Remove unused resources
2022-03-18 17:45:36 +01:00
Jonathan Bregler
9388abb589 Integrate SAP Hana as supported Spring Batch database
This commit adds SAP HANA as a supported Spring Batch database, enabling
developers to seamlessly move their existing Spring Batch projects to SAP HANA
or easily starting new Spring Batch projects on SAP HANA.

This commit contains the following changes:

- Add SAP HANA to the DatabaseType enum
- Add HanaPagingQueryProvider and tests
- Add properties files for SAP HANA

Issue #2515
2022-03-18 16:52:50 +01:00
Mahmoud Ben Hassine
9cbde4eea6 Fix RepositoryFunctionalTests
Due to the decoupling of `PagingAndSortingRepository` from
`CrudRepository` in Spring Data 3 [1], this test has to be updated
to use different repositories between the reader and the writer
according to the expected types for the `repository` property.

[1]: https://github.com/spring-projects/spring-data-commons/issues/2537
2022-03-16 17:15:56 +01:00
Mahmoud Ben Hassine
ae6c0b9809 Refine contribution #4065
* Fix tests
* Update Javadocs
* Update year in license headers
* Move observability APIs to a separate package
2022-03-16 17:03:14 +01:00
Marcin Grzejszczak
e917d75d20 Add Observation API
Issue #4065
2022-03-16 16:14:50 +01:00
Jonatan Ivanov
c1aec1d0ea Upgrade next version of Micrometer and fix breaking changes 2022-02-17 12:29:28 +01:00
Mahmoud Ben Hassine
e5c752b4b8 Remove JSR-352 implementation
Resolves #3894
2021-12-13 09:57:48 +01:00
Mahmoud Ben Hassine
411055f433 Update dependencies 2021-11-24 11:09:02 +01:00
Mahmoud Ben Hassine
0d3282554c Remove the unconditional exposure of the transaction manager as a bean
This commit removes the unconditional exposure of the transaction
manager as a bean in the application context. The transaction manager
is still taken from the BatchConfigurer and set where needed (ie on
JobRepository and StepBuilderFactory) as previously done,
but is not exposed anymore as a bean to prevent any clash with a user
defined transaction manager.

If no transaction manager is provided, a DataSourceTransactionManager
will be configured by default as required by batch (without being exposed
as a bean).

Resolves #816
2021-11-22 15:35:02 +01:00
Mahmoud Ben Hassine
5dc17b190e Upgrade dependencies to major versions for Spring Batch 5
* Upgrade to Jakarta EE 9
* Upgrade to Spring Framework 6
* Upgrade to Spring Integration 6
* Upgrade to Spring Data 3
* Upgrade to Spring AMQP 3
* Upgrade to Spring for Apache Kafka 3

LDIF support is still in progress waiting for the next
major version of Spring LDAP.

Closes #4027
Closes #3656
2021-11-22 12:16:49 +01:00
Mahmoud Ben Hassine
327160a3ab Change metrics type from int to long in StepExecution
This change prevents integer overflows in
steps operating on a large number of items.

Resolves #3650
2021-09-29 15:38:32 +02:00
Mahmoud Ben Hassine
e8bbde10e5 Remove unused imports 2021-09-12 22:23:56 +02:00
Mahmoud Ben Hassine
f85a662ebf Refine contribution #3934
* Add default methods in all listener interfaces
* Remove usage of newly deprecated support classes

Issue #3924
2021-09-10 22:05:02 +02:00
Rémi Kaeffer
a6d68138ff Fix double "the" typo everywhere in source code 2021-09-03 19:07:19 +02:00
Mahmoud Ben Hassine
de9ce2d0cc Use JdbcTestUtils where appropriate in tests 2021-08-26 22:12:34 +02:00
Mahmoud Ben Hassine
3742931c4c Remove unused resources 2021-08-26 17:03:32 +02:00
Mahmoud Ben Hassine
da9dbdeeac Fix JsonSupportIntegrationTests 2021-08-18 08:59:26 +02:00
Mahmoud Ben Hassine
4b3bcac082 Update datasource configuration in samples/tests 2021-08-17 22:52:45 +02:00
Mahmoud Ben Hassine
36b63ed283 Remove usage of master/slave terminology 2021-08-17 21:59:30 +02:00
Mahmoud Ben Hassine
f8bdf5521e Remove the Map based job repository/explorer and their DAOs
This commit removes the deprecated Map-based job repository
and job explorer implementations with their respective DAOs.
Using the `EnableBatchProcessing` annotation now requires a
datasource bean to be defined in the application context.
This will be reviewed as part of #3942.

This commit is a first pass that updates related tests to use
the JDBC-based job repository/explorer with an embedded database.
A second pass should be done to improve tests by caching/reusing
embedded databases if possible.

Issue #3836
2021-08-17 16:23:46 +02:00
Mahmoud Ben Hassine
d5509d2444 Remove SQLFire support
Resolves #3839
2021-08-14 08:53:16 +02:00
Mahmoud Ben Hassine
1b829471ee Remove unused constant in CustomerCreditUpdatePreparedStatementSetter 2021-08-12 22:05:59 +02:00
Mahmoud Ben Hassine
27e11b52f9 Remove usage of deprecated APIs
Resolves #3838
2021-08-12 15:51:02 +02:00
Parikshit Dutta
86e1b0a3a9 Updated graceful shutdown sample by removing deprecated code
Resolves #3901
2021-08-11 21:27:55 +02:00
Mahmoud Ben Hassine
31899d5fc3 Remove usage of deprecated APIs
Issue #3838
2021-08-11 20:23:12 +02:00
Henning Pöttker
64c09c523e Replaces deprecated interfaces
Replaces the deprecated
- type InstantiationAwareBeanPostProcessorAdapter
- type GenericTypeResolver
- method StringUtils::isEmpty
- field BigDecimal::ROUND_HALF_UP

Issue #3838
2021-08-11 15:20:18 +02:00
Mahmoud Ben Hassine
b9790d11ba Fix datasource initialization in remote partitioning samples 2021-08-11 14:06:04 +02:00
Philippe Marschall
c9e06b2a7f Don't call wrapper constructors directly
The constructors of the wrapper classes for primitives (Double,
Integer, Long) have been deprecated since JDK 9 and should no longer be
called. Instead the static factory #valueOf should be used.
2021-08-10 11:54:25 +02:00
Henning Poettker
0ad68037b6 Reduce naming collisions in consecutive tests 2021-08-09 13:36:31 +02:00