This rule flags Spring bean configurations where the class attribute value is
org.springframework.jms.listener.DefaultMessageListenerContainer
and the bean does not have either of the properties
taskExecutor
or
transactionManager
configured.
The bean in the following Spring configuration example would be flagged because it is missing the required properties.
<bean id="msgListener" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
</bean>
The user should configure the bean to use the property
taskExecutor
with the class
org.springframework.scheduling.commonj.WorkManagerTaskExecutor
and the property
transactionManager
with the class
org.springframework.transaction.jta.WebSphereUowTransactionManager
.
An example of a correctly configured bean follows:
<bean id="messageListener" class="sample.ExampleMessageListener">
<bean id="msgListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="destination" ref="jmsQueue" />
<property name="messageListener" ref="messageListener" />
<property name="transactionManager" ref="transactionManager" />
<property name="taskExecutor" ref="myTaskExecutor" />
</bean>
<bean id="myTaskExecutor"
class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
<property name="workManagerName" value="wm/default" />
</bean>
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
</bean>
<jee:jndi-lookup id="jmsConnectionFactory" jndi-name="jms/CF1" />
<jee:jndi-lookup id="jmsQueue" jndi-name="jms/jmsQueue" />
</bean>
For additional information, see: