0
我有以下配置,一切似乎都很好,我没有收到任何错误。 但是,当我打印jmsTemplate.getDefaultDestinationName(),我得到空 我应该看到“myQueue”?DefaultDestination的Spring JMS配置
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="mqConnectionFactory"/>
</property>
<property name="defaultDestination">
<ref bean="destination" />
</property>
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="myQueue" />
</bean>
我很困惑,你说它确实会返回一个值,如果它是直接设置的,而且你说我做了,但是起初你对我的问题说'不'。那么,我应该看到null还是'myQueue'? – bmw0128
我以为我很清楚 - 你设置了'defaultDestination'属性,在这种情况下'getdefaultDestination()'返回非null。如果你设置了'defaultDestinationName'属性,那么'getdefaultDestinationName()'将返回非空值。如果你设置了'defaultDestination'属性,那么'getDefaultDestinationName()'将返回null,反之亦然。换句话说,你得到你设定的。 –