<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- JNDI上下文模板 -->
<bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<!-- your weblogic url -->
<prop key="java.naming.provider.url">t3://192.168.1.125:7001</prop>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<!--weblogic username and password -->
</props>
</property>
</bean>
<!-- 连接工厂配置-->
<bean id="jmsConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>weblogic.jms.ConnectionFactory</value>
</property>
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
</bean>
<!-- 发送队列配置 -->
<bean id="destinatinForSender"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>ma/ke</value>
</property>
</bean>
<bean id="jmsConverter"
class="org.springframework.jms.support.converter.SimpleMessageConverter" />
<!-- JMS template配置 -->
<bean id="jmsTemplateSender"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="jmsConnectionFactory" />
</property>
<property name="defaultDestination">
<ref bean="destinatinForSender" />
</property>
<property name="messageConverter">
<ref bean="jmsConverter" />
</property>
</bean>
<!-- 接收队列配置 -->
<bean id="destinatinForReceiver"
class="org.springframework.jndi.JndiObjectFactoryBean" singleton="false">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>ma/ke</value>
</property>
</bean>
<bean id="jmsTemplateReceiver"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="jmsConnectionFactory" />
</property>
<property name="defaultDestination">
<ref bean="destinatinForReceiver" />
</property>
<property name="messageConverter">
<ref bean="jmsConverter" />
</property>
</bean>
</beans>