Hi,
I guess in your case you could use a custom
ConstraintValidatorFactory. The default factory uses the public no-arg constructor to instantiate a validator implementation. Using a custom factory you can use other means to instantiate the validator. For example you could inject a
CostUnitManager via dependency injection. You can determine which factory is used via the
Configuration object, eg
Code:
Validation.byDefaultProvider().configure().constraintValidatorFactory(new MyFactory()).buildValidatorFactory()
See also section 2.5 of the specification.
--Hardy