-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Description
The current implementation of file handling across different Java generator libraries is inconsistent when using the useAbstractionForFiles property. While the resttemplate library was successfully updated to use Spring's org.springframework.core.io.Resource interface (via PR #7051), the webclient and restclient generators have not been aligned with this standard. They still rely on the AbstractResource class or lack the unified abstraction entirely.
This inconsistency creates challenges when maintaining shared code or migrating between HTTP clients (e.g. from resttemplate to webclient or restclient), as it requires implementing client-specific workarounds for file handling.
Solution
I propose standardizing the behavior of the useAbstractionForFiles property across the webclient and restclient libraries to match the implementation introduced for resttemplate.
Specifically, when useAbstractionForFiles is enabled, both webclient and restclient should generate code that utilizes the org.springframework.core.io.Resource interface instead of the AbstractResource class. This will ensure uniform and seamless file handling across all Spring-based Java generators.
Additional context
This request is a continuation of the broader effort to improve and standardize file handling in Java generators.
For reference, please see the related discussions and PRs:
Issue #6715: [Java] useAbstractionForFiles does not work for spring / webclient
PR #7051: [Java][RestTemplate] Use Spring Resource interface instead of AbstractResource for file abstraction (reference implementation)