From 5c57ed47b8be4b3419229f0617cba895610ab9bc Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 30 Sep 2020 15:13:00 +0200 Subject: [PATCH] Update "what's new" section for version 4.3 --- spring-batch-docs/asciidoc/whatsnew.adoc | 142 ++++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/spring-batch-docs/asciidoc/whatsnew.adoc b/spring-batch-docs/asciidoc/whatsnew.adoc index b155ed6e1..36e5698db 100644 --- a/spring-batch-docs/asciidoc/whatsnew.adoc +++ b/spring-batch-docs/asciidoc/whatsnew.adoc @@ -6,4 +6,144 @@ == What's New in Spring Batch 4.3 -TDB +This release comes with a number of new features, performance improvements, +dependency updates and API deprecations. This section describes the most +important changes. For a complete list of changes, please refer to the +https://github.com/spring-projects/spring-batch/releases/tag/4.3.0[release notes]. + +[[newFeatures]] +=== New features + +==== New synchronized ItemStreamWriter + +Similar to the `SynchronizedItemStreamReader`, this release introduces a +`SynchronizedItemStreamWriter`. This feature is useful in multi-threaded steps +where concurrent threads need to be synchronized to not override each other's writes. + +==== New JpaQueryProvider for named queries + +This release introduces a new `JpaNamedQueryProvider` next to the +`JpaNativeQueryProvider` to ease the configuration of JPA named queries when +using the `JpaPagingItemReader`: + +[source, java] +---- +JpaPagingItemReader reader = new JpaPagingItemReaderBuilder() + .name("fooReader") + .queryProvider(new JpaNamedQueryProvider("allFoos", Foo.class)) + // set other properties on the reader + .build(); +---- + +==== New JpaCursorItemReader Implementation + +JPA 2.2 added the ability to stream results as a cursor instead of only paging. +This release introduces a new JPA item reader that uses this feature to +stream results in a cursor-based fashion similar to the `JdbcCursorItemReader` +and `HibernateCursorItemReader`. + +==== New JobParametersIncrementer implementation + +Similar to the `RunIdIncrementer`, this release adds a new `JobParametersIncrementer` +that is based on a `DataFieldMaxValueIncrementer` from Spring Framework. + +==== GraalVM Support + +This release adds initial support to run Spring Batch applications on GraalVM. +The support is still experimental and will be improved in future releases. + +==== Java records Support + +This release adds support to use Java records as items in chunk-oriented steps. +The newly added `RecordFieldSetMapper` supports data mapping from flat files to +Java records, as shown in the following example: + +[source, java] +---- +@Bean +public FlatFileItemReader itemReader() { + return new FlatFileItemReaderBuilder() + .name("personReader") + .resource(new FileSystemResource("persons.csv")) + .delimited() + .names("id", "name") + .fieldSetMapper(new RecordFieldSetMapper<>(Person.class)) + .build(); +} +---- + +In this example, the `Person` type is a Java record defined as follows: + +[source, java] +---- +public record Person(int id, String name) { } +---- + +The `FlatFileItemReader` uses the new `RecordFieldSetMapper` to map data from +the `persons.csv` file to records of type `Person`. + +[[performanceImprovements]] +=== Performance improvements + +==== Use bulk writes in RepositoryItemWriter + +Up to version 4.2, in order to use `CrudRepository#saveAll` in `RepositoryItemWriter`, +it was required to extend the writer and override `write(List)`. + +In this release, the `RepositoryItemWriter` has been updated to use +`CrudRepository#saveAll` by default. + +==== Use bulk writes in MongoItemWriter + +The `MongoItemWriter` used `MongoOperations#save()` in a for loop +to save items to the database. In this release, this writer has been +updated to use `org.springframework.data.mongodb.core.BulkOperations` instead. + +==== Job start/restart time improvement + +The implementation of `JobRepository#getStepExecutionCount()` used to load +all job executions and step executions in-memory to do the count on the framework +side. In this release, the implementation has been changed to do a single call to +the database with a SQL count query in order to count step executions. + +[[dependencyUpdates]] +=== Dependency updates + +This release updates dependent Spring projects to the following versions: + +* Spring Framework 5.3 +* Spring Data 2020.0 +* Spring Integration 5.4 +* Spring AMQP 2.3 +* Spring for Apache Kafka 2.6 +* Micrometer 1.5 + +[[deprecation]] +=== Deprecations + +[[apiDeprecation]] +==== API deprecation + +The following is a list of APIs that have been deprecated in this release: + +* `org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean` +* `org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean` +* `org.springframework.batch.core.repository.dao.MapJobInstanceDao` +* `org.springframework.batch.core.repository.dao.MapJobExecutionDao` +* `org.springframework.batch.core.repository.dao.MapStepExecutionDao` +* `org.springframework.batch.core.repository.dao.MapExecutionContextDao` +* `org.springframework.batch.item.data.AbstractNeo4jItemReader` +* `org.springframework.batch.item.file.transform.Alignment` +* `org.springframework.batch.item.xml.StaxUtils` +* `org.springframework.batch.core.launch.support.ScheduledJobParametersFactory` +* `org.springframework.batch.item.file.MultiResourceItemReader#getCurrentResource()` +* `org.springframework.batch.core.JobExecution#stop()` + +Suggested replacements can be found in the Javadoc of each deprecated API. + +[[sqlfireDeprecation]] +==== SQLFire support deprecation + +SQLFire has been in https://www.vmware.com/latam/products/pivotal-sqlfire.html[EOL] +since November 1st, 2014. This release deprecates the support of using SQLFire +as a job repository and schedules it for removal in version 5.0.