---
title: "spring 配置连接Websphere MQ"
author: "ganen11"
date: "2014-02-12T15:21:43Z"
tags: []
categories: ["研发管理"]
slug: "spring-websphere-mq"
draft: false
lastmod: "2014-02-26T17:23:01Z"
id: 2015674
url: "https://ganen11.iteye.com/blog/2015674"
---

&lt;beans&gt;  
&lt;bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"&gt;  
&lt;property name="hostName" value="192.168.7.120" /&gt;  
&lt;property name="port" value="1414" /&gt;  
&lt;property name="queueManager" value="WXLOCALQM" /&gt;  
&lt;/bean&gt;

&lt;bean id="queue01" class="com.ibm.mq.jms.MQQueue"&gt;  
&lt;property name="baseQueueName" value="LOCAL.Q.01" /&gt;  
&lt;/bean&gt;

&lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;  
&lt;property name="connectionFactory" ref="jmsConnectionFactory" /&gt;  
&lt;property name="defaultDestination" ref="queue01" /&gt;  
&lt;property name="pubSubDomain" value="false" /&gt;  
&lt;/bean&gt;  
&lt;/beans&gt;

 

附件是一个开源的SpringJMS的工程，只需要将其中的spring.xml中的配置用上述配置替换，就可以连接Websphere MQ了。