Spring Integration Transformer (Custom Transformer and Annotations) :Lab10
As with filters and many other SI components, you can create your own custom
transformer. When the transformation is particularly complex or when you need to
transform to / from a type that Spring does not know about, you will find custom
transformation the route to take. In this next step, you create a custom transformer – one
that transforms the string payload of the source message to a pig Latin translation of the
string in the target message. In this step, you also see the use of annotations to configure
your transformer. SI (and all of Spring) allows the use of annotations in your Java code to
simplify the configuration of components and reduce the amount of XML associated to your
application. While annotations were not used in the prior labs (like the filter lab), you will
find that SI comes with a number of annotations that can be used in place of XML for the
configuration of just about any SI component.
Examine and annotate the Transformer class. A class containing the Pig Latin
conversion code has already been created for you. You just need to annotate it in
order to designate it as a transformer for SI.