[hibernate-dev] Message-Templates from multiple JARs
Emmanuel Bernard
emmanuel at hibernate.org
Thu Feb 18 03:10:14 EST 2010
OK so let's prototype that then:
- implement a service locator style way of declaring / finding resource bundles (not resource bundle files)
- implement a ResourceBundle aggregator that gives priority to ValidationMessages
- see how bad/good that can play with http://opensource.atlassian.com/projects/hibernate/browse/HV-238
Gunnar, can you take the lead, we are a a bit busy on other things for the next few weeks.
PS: I'd still like to get Max's reply on my Eclipse questions though :)
On 18 févr. 2010, at 02:38, Hardy Ferentschik wrote:
> On Tue, 16 Feb 2010 18:41:12 -0300, Gunnar Morling
> <gunnar.morling at googlemail.com> wrote:
>
>> I agree with Max, I think there should be some way for packaging message
>> bundles within components containing constraint annotations, while
>> offering
>> the possibility to optionally override these with custom messages if
>> required.
>>
>> With respect to large-scale enterprise apps, I guess it can become quite
>> impractical to demand, that all component teams provide one single
>> message
>> bundle. Also having to copy contents of message bundles from 3rd-party
>> libs
>> containing constraint annotations to the local bundle could get somewhat
>> tedious.
>>
>> Providing a custom MessageInterpolator might be viable, nevertheless I
>> think, such a mechanism should work out of the box.
>
> Well, having a simple configuration option is almost like "out of the box".
> For most cases the default behavior will be good enough and for the few
> cases
> a simple configuration option will do the trick.
>
>> Not sure though, what the best solution here is. I also thought about
>> merging the ValidationMessages.properties from different
>> libraries/components (similar to what java.util.ServiceLoader does) into
>> one
>> bundle, giving the contents from the local ValidationMessages.properties
>> precedence. That way components could provide message texts for their
>> constraints (name clashes are possible but actually shouldn't happen, as
>> message keys should be fully-qualified), while offering the possibility
>> to override these texts within the local bundle if required.
>
> This could be one of the custom ResourceBundleLocator strategies we have
> been talking about.
>
> --Hardy
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list