[bv-dev] Validation.properties ResourceBundle and modularity

Hardy Ferentschik hardy at hibernate.org
Tue Sep 20 13:08:29 EDT 2011


Hi Ed,

I don't think this is a good example of payload usage. IMO it would make  
more sense
to change the MessageInterpolator.Context class and add the validated bean  
type to this
context.

On a tangent, Hibernate Validator introduced the concept of a  
ResourceBundleLocator [1]
which could be useful for your described use case as well.

As far as I remember the inclusion of such an interface or more general  
the separation of
MessageResolver and MessageInterpolator are on the agenda of BV 1.1.

--Hardy


[1] https://hibernate.onjira.com/browse/HV-238

On Tue, 20 Sep 2011 17:02:07 +0200, Ed Burns <edward.burns at oracle.com>  
wrote:

> Hello Experts,
>
> I understand this may be off topic, but I am not sure how to best bring
> this to your attention, so please excuse this email.
>
> GlassFish uses JSR-303 for ensuring that its configuration information
> is valid.  In the course of this usage, we ran into an apparent
> shortcoming in the JSR-303 spec regarding ClassLoaders and the
> Validation.properties ResourceBundle.  A succint writeup of the problem
> is at [1] but in 140 characters or less, the problem is:
>
>   In a MessageInterpolatorImpl, I need a reference to the .class to
>   which the constraint is applied, *without using payload*.
>
> In other words, can we make the default value of the payload attribute
> be the .class to which the constraint is applied?
>
> Thank you,
>
> Ed
>
> [1]  
> http://wikis.sun.com/display/GlassFish/GlassFish+Bean+Validation+Error+Message+Internationalization


More information about the beanvalidation-dev mailing list