From https://github.com/hibernate/hibernate-validator/pull/148:
I'm wondering whether we need to release/destroy the created beans for message interpolator, parameter name provider etc. (as we do with created CDI constraint validators). Or is this happening somewhere?
It depends if the bean has been created by you or not:
- when a bean instance is passed to the programmatic configuration API, then the provider is not responsible
- when the bean class is provided (say via the XML file), then yes.
The rule of thumb is that what you create, you release. What you receive you leave alone.
|