Skip to content

Add DataSize converters to DefaultConversionService#36830

Open
yeomin4242 wants to merge 1 commit into
spring-projects:mainfrom
yeomin4242:main
Open

Add DataSize converters to DefaultConversionService#36830
yeomin4242 wants to merge 1 commit into
spring-projects:mainfrom
yeomin4242:main

Conversation

@yeomin4242
Copy link
Copy Markdown

This PR adds default String and Number to DataSize converters to
DefaultConversionService.

Spring Boot already provides equivalent converters, and DataSize itself
already exposes parsing support via DataSize.parse(...). This change makes
that conversion available through Spring Framework's default conversion service.

Changes:

  • Add StringToDataSizeConverter delegating to DataSize.parse(CharSequence)
  • Add NumberToDataSizeConverter delegating to DataSize.parse(source.toString())
  • Register both converters with DefaultConversionService
  • Add DefaultConversionService tests for string, number, empty, and invalid inputs

This intentionally does not move Spring Boot's @DataSizeUnit support into
Spring Framework.

Closes gh-28910

Signed-off-by: YeongJae Min <whereismysejong@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 23, 2026
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels May 23, 2026
@sbrannen sbrannen removed the status: waiting-for-triage An issue we've not yet triaged or decided on label May 23, 2026
@sbrannen sbrannen added this to the 7.1.0-M1 milestone May 23, 2026
@sbrannen sbrannen self-assigned this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Converter for DataSize

3 participants