Skip to content

Commit 1b722f6

Browse files
committed
Update documentation for release 5.0.0-M7
1 parent e866108 commit 1b722f6

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

spring-batch-docs/src/main/asciidoc/whatsnew.adoc

+54
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Spring Batch 5.0 has the following major themes:
1515
* Dependencies Re-baseline
1616
* Batch infrastructure configuration updates
1717
* Batch testing configuration updates
18+
* Job parameters handling updates
1819
* New features
1920
* Pruning
2021

@@ -154,6 +155,58 @@ customizing the transaction attributes.
154155
The same transaction support was added to the `JobOperator` through a new factory bean
155156
named `JobOperatorFactoryBean`.
156157

158+
[[job-parameters-handling-updates]]
159+
=== Job parameters handling updates
160+
161+
==== Support for any type as a job parameter
162+
163+
This version adds support to use any type as a job parameter, and not only the 4 pre-defined
164+
types (long, double, string, date) as in v4. This change has an impact on how job parameters
165+
are persisted in the database (There are no more 4 distinct columns for each predefined type).
166+
Please check link:$$https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-5.0-Migration-Guide#column-change-in-batch_job_execution_params$$[Column change in BATCH_JOB_EXECUTION_PARAMS]
167+
for DDL changes. The fully qualified name of the type of the parameter is now persisted as a `String`,
168+
as well as the parameter value. String literals are converted to the parameter type with the standard
169+
Spring conversion service. The standard conversion service can be enriched with any required converter
170+
to convert user specific types to and from String literals.
171+
172+
==== Default job parameter conversion
173+
174+
The default notation of job parameters in v4 was specified as follows:
175+
176+
```
177+
[+|-]parameterName(parameterType)=value
178+
```
179+
180+
where `parameterType` is one of `[string,long,double,date]`. This notation is limited, constraining,
181+
does not play well with environment variables and is not fiendly with Spring Boot.
182+
183+
In v5, there are two way to specify job parameters:
184+
185+
===== Default notation
186+
187+
The default notation is now specified as follows:
188+
189+
```
190+
parameterName=parameterValue,parameterType,identificationFlag
191+
```
192+
193+
where `parameterType` is the fully qualified name of the type of the parameter. Spring Batch provides
194+
the `DefaultJobParametersConverter` to support this notation.
195+
196+
===== Extended notation
197+
198+
While the default notation is well suited for the majority of use cases, it might not be convenient when
199+
the value contains a comma for example. In this case, the extended notation can be used, which is inspired
200+
by Spring Boot's link:$$https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.application-json$$[Json Application Properties]
201+
and is specified as follows:
202+
203+
```
204+
parameterName='{"value": "parameterValue", "type":"parameterType", "identifying": "booleanValue"}'
205+
```
206+
207+
where `parameterType` is the fully qualified name of the type of the parameter. Spring Batch provides the
208+
`JsonJobParametersConverter` to support this notation.
209+
157210
[[batch-testing-configuration-updates]]
158211
=== Batch Testing Configuration Updates
159212

@@ -209,6 +262,7 @@ We took the opportunity of this major release to improve the code base with feat
209262

210263
* Use default methods in interfaces and deprecate "support" classes (see link:$$https://github.com/spring-projects/spring-batch/issues/3924$$[issue 3924])
211264
* Add `@FunctionalInterface` where appropriate in public APIs (see link:$$https://github.com/spring-projects/spring-batch/issues/4107$$[issue 4107])
265+
* Add support to use types from the Date and Time APIs as job parameters. (see link:$$https://github.com/spring-projects/spring-batch/issues/1035$$[issue 1035$$])
212266

213267
==== Support for SAP HANA a job repository in Spring Batch
214268

0 commit comments

Comments
 (0)