Spring Message-Driven POJOs

This is probably one of my favorite features of Spring. This simple configuration will enable any method of any class to receive JMS messages asynchonously and send a response, if needed...

<bean id="echoBean" class="com.samples.Echo" />
   
<jms:listener-container
        connection-factory="connectionFactory"
        destination-type="queue"
        concurrency="10">
   <jms:listener destination="com.samples.queue" ref="echoBean" method="echo"/>
</jms:listener-container>

If echo has a return type, it will automatically be converted to a JMS Message and sent to the destination specified in the JMSReplyTo attribute of the incoming message. Sweet!