April 2012
Beginner
96 pages
2h 26m
English
You can use Framework’s @Transformer annotation to refer to the
transformer bean from your config file. The component-scan allows the container to scan for
annotated beans in the transformers
package, In this case, the AnnotatedTradeMapTransformer class will be
instantiated:
@Component
public class AnnotatedTradeMapTransformer {
@Transformer
public Map<String, String> transform(Trade t) {
Map<String,String> tradeNameValuesMap =
new HashMap<String,String>();
....
return tradeNameValuesMap;
}
}The annotated transform method is
invoked when a message arrives in the in-channel. The configuration is similar to
the one we have already seen, except the component-scan tag is added. This scans for the
beans decorated with @Component and creates instances
of them once found in the application context container:
<context:component-scan base-package="com.madhusudhan.jsi.flow.transformer" />
Read now
Unlock full access