Increase reusability of Validator
[SPR-15314]
#19877
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Daniel Gulyas opened SPR-15314 and commented
Quick summary
Hi!
It would be really cool if the Validator implementations could be reused at the Service level hassle-free.
It would be cool because:
Example scenario when that happens:
controller <-dto-> service
, at the controller-side the dto is validated with the ValidatorNow there's a possibility to reuse the Validator created for the controller at the service level, but for me it seems to involves quite a hassle, it would be nice to make that convenient.
Proposal
The namings for me seem to be a bit weak, they could handle suggestions I'm pretty sure.
For existing Validator implementations there's only need to extend this abstract class and it'll turn into a validator which is convenient to use at the service level, please see the attached java files, this might be a bit invasive although.
Follow-up
This is just an idea and i'm kinda new to Spring and to Java in general so the proposal will probably include foolish design mistakes, i looked it up and so far i haven't seen anything which would make reusing of these easy, please point it out if there's already some.
If that's cool to do and there's a consensus i could make a pr for this in the coming days.
Let me know what you think!
Attachments:
The text was updated successfully, but these errors were encountered: