Add parameter converters for ZonedDateTime and OffsetDateTime#5179
Closed
thswlsqls wants to merge 1 commit intospring-projects:mainfrom
Closed
Add parameter converters for ZonedDateTime and OffsetDateTime#5179thswlsqls wants to merge 1 commit intospring-projects:mainfrom
thswlsqls wants to merge 1 commit intospring-projects:mainfrom
Conversation
- Add ZonedDateTimeToStringConverter and StringToZonedDateTimeConverter - Add OffsetDateTimeToStringConverter and StringToOffsetDateTimeConverter - Register new converters in DefaultJobParametersConverter - Add unit tests for all new converters - Add integration tests for JobParameters with ZonedDateTime/OffsetDateTime - Update JavaDoc in DefaultJobParametersConverter Closes spring-projects#5178 Signed-off-by: eunbin <[email protected]>
Contributor
|
Hi @thswlsqls, I left some thoughts about a different strategy to fix this at #5178 (comment). (Please note that I'm not part of the Spring Batch team) |
Contributor
|
LGTM 👍 Rebased and merged as 868849e. Thank you very much for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds JobParameters converters for
ZonedDateTimeandOffsetDateTimeto support timezone-aware date/time parameters in Spring Batch jobs.Changes
ZonedDateTimeToStringConverterandStringToZonedDateTimeConverterOffsetDateTimeToStringConverterandStringToOffsetDateTimeConverterDefaultJobParametersConverterDefaultJobParametersConverterTestsfor JobParameters with ZonedDateTime/OffsetDateTimeDefaultJobParametersConverterto document the new supported typesTesting
All tests have been verified to pass successfully. The following test results were obtained when running tests with pre-compiled classes.
Test Execution Results
Unit Tests for New Converters:
Results:
ZonedDateTimeToStringConverterTests: 2 tests, all passingStringToZonedDateTimeConverterTests: 2 tests, all passingOffsetDateTimeToStringConverterTests: 2 tests, all passingStringToOffsetDateTimeConverterTests: 2 tests, all passingIntegration Tests:
./mvnw test -pl spring-batch-core -Dtest=DefaultJobParametersConverterTestsResults:
DefaultJobParametersConverterTests: 22 tests (including 6 new integration tests), all passingtestGetParametersWithZonedDateTime()- Verifies ZonedDateTime conversion from Properties to JobParameterstestGetParametersWithOffsetDateTime()- Verifies OffsetDateTime conversion from Properties to JobParameterstestGetPropertiesWithZonedDateTime()- Verifies ZonedDateTime conversion from JobParameters to PropertiestestGetPropertiesWithOffsetDateTime()- Verifies OffsetDateTime conversion from JobParameters to PropertiestestRoundTripWithZonedDateTime()- Verifies round-trip conversion for ZonedDateTimetestRoundTripWithOffsetDateTime()- Verifies round-trip conversion for OffsetDateTimeFull Test Suite:
./mvnw test -pl spring-batch-coreResults:
Code Style Validation:
Note on Local Build Environment:
Usage Example
Related Issue
Closes #5178
Checklist
mainbranch@sincetag added (6.0.3)