-
Notifications
You must be signed in to change notification settings - Fork 38.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide support for post-processing a LocalValidatorFactoryBean's validator Configuration without requiring sub-classing #27956
Comments
I've seen more and more different customizers pop up in Spring and Spring Boot code. Things like the But isn't this also the task of a I do get that the |
|
Not in all cases, the I pointed out that there seems to be an emerging pattern for customizing beans outside of the regular |
@wilkinsona would it be sufficient to let The main question for me is the use of a special customizer type. Would you want to reuse it in Boot? If you'll be doing a custom customizer type in any case, we could also simply go with |
It would.
If Framework provided a
If it were a plain In short, both would work pretty much equally well for Boot. I should also say that I don't consider this change to be urgent. It would be nice to deliver something in Boot 2.x, but it's far from essential. We could live with a change in Framework 6 and Boot 3 if that aligns better with Framework's goals/priorities. |
I went with a |
Affects: 5.3
LocalValidatorFactoryBean
currently allows the validatorConfiguration
to be post-processed but this requires a custom sub-class and an override ofpostProcessConfiguration
. Given that Framework itself already provides a sub-class (OptionalValidatorFactoryBean
) this is a little awkward as you have to know which class to sub-class or maybe sub-class both depending on circumstances.A Spring Boot user has proposed an enhancement to make it easier to register
ValueExtractor
s with theConfiguration
. We'd like to do this via composition with some sort ofConfigurationPostProcessor
orConfigurationCustomizer
callback. We could create our ownLocalValidatorFactoryBean
sub-class that enables this customization but that functionality would then be lost by anyone who's usingOptionalValidatorFactoryBean
instead.We wondered if Framework could add a callback-based mechanism for post-processing the
Configuration
instead. We could then auto-configure theLocalValidatorFactoryBean
with any post-processors/customizers found in the context and users could implement one to register theirValueExtractor
without resorting to inheritance.The text was updated successfully, but these errors were encountered: