10.3 Injecting Message Source Behavior - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
10.3 Injecting Message Source Behavior
Any component may gain the ability to resolve messages through the application's MessageSource. You only need annotate the class withgriffon.transform.MessageSourceAware
and it will automatically gain all methods exposed by MessageSource
.This feature is just a shortcut to avoid reaching for the application instance from objects that do not hold a reference to it.Here's an example of a custom Java bean that's able to resolve messages@griffon.transform.MessageSourceAware
class Bean {
String name
}
class SampleService { String lookupValues(String arg) { Bean bean = new Bean(name: arg) bean.getMessage('some.message.key', [bean.name]) } }