Hi Nik,
The ResourceBundleLocator contract has been re-located as of Hibernate Validator 5 as part of our efforts for clearly separating public API, SPI and internal parts of the code base. Generally HV 5 is no 100% drop-in replacement for HV 4; It might require this sort of adaption to a few changed packages, although we tried to minimize the impact.
Supporting both versions is an interesting challenge :) Out of my head I can see the following two approaches:
1) Build two different variants of your application, one compiled against HV 4.2, one compiled against HV 5.1. Often that's not desirable, though. 2) Have two versions of your ResourceBundleLocator implementation (one for 4.2, one for 5.1) and include both in your application (for this to work it may be required to put those two implementations into two different JARs which each are built against one HV version); then you could configure one or the other implementation in your META-INF/validation.xml file if you have a way to process that file during deployment or e.g. contribute it through some environment-specific configuration JAR etc. Alternatively, if you bootstrap your validator (factory) programmatically via Validation#buildValidatorFactory(), you could configure one locator or the other based on the environment (e.g. by reflectively checking which version of the RBL contract exists).
Hth,
--Gunnar
_________________ Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/
|