@Stereotype @Target(value=TYPE) @Retention(value=RUNTIME) @Documented public @interface MessageBundle
This annotation must only be used on interfaces. If this annotation gets used on a concrete class, a deployment error results!
Each method on an interface annotated with
@MessageBundle will form a type-safe message. The
message lookup key (resource bundle key) can either be defined by annotating those methods with
MessageTemplate) or by convention. if no @
MessageTemplate annotation is used on a method,
the case sensitive method name name will be used as resource key.
The parameters of the declared methods will be automatically passed as message parameters to the
MessageResolver. Please note that all passed parameters should be
Serializable. If a parameter is not Serializable, we will instead store the
of the passed parameter.
ResourceBundle or other resource lookup source which might be used is determined by the
MessageResolver in conjunction with
MessageContext.messageSource(String...). The fully qualified class
name of the interface annotated with @MessageBundle will automatically be registered as additional
messageSource for those messages.
By default the Message Source is a resource bundle with the same name as the
annotated interface, e.g.
@MessageBundle can be combined with
MessageContextConfig to further customize the
message resolution and processing. To use a different resourcebundle, e.g.
somepath/myownmessages_en.properties you might write:
@MessageBundle @MessageContextConfig(messageSource = "somepath/myownmessages")
Debug hint: Set a breakpoint in
MessageBundleInvocationHandler#invoke. This will get called for every
message bundle invocation.
Copyright © 2017 The Apache Software Foundation. All rights reserved.