Description:
|
From https://github.com/hibernate/hibernate-validator/pull/148:
{quote}
Gunnar:
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? {quote}
{quote}
Emmanuel:
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. {quote}
And:
{quote} Gunnar: Couldn't {{InjectingConstraintValidatorFactory}} be managed by CDI so we could use CDI's pre-destroy hook to release everything? In other words, do we need {{ConstraintValidatorFactory#releaseInstance()}} at all? In another comment Emmanuel said "who creates things has to release them", that's right and thus I think {{ConstraintValidatorFactory}} should itself be responsible to release its created validators when it is closed/destroyed itself. {quote}
|