mq和spring结合使用,导致每次启动服务器都会卡在applicationContext-mq.xml那

使用mq后,每次都会停在

10:26:18,457  INFO ContextLoader:285 - Root WebApplicationContext: initialization started
10:26:18,590  INFO XmlWebApplicationContext:510 - Refreshing Root WebApplicationContext: startup date [Tue Mar 06 10:26:18 CST 2018]; root of context hierarchy
10:26:18,649  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationContext.xml]
10:26:18,996  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationContext-dataSource.xml]
10:26:19,254  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationContext-webService.xml]
10:26:19,396  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationContext-quartz.xml]
10:26:19,414  INFO XmlBeanDefinitionReader:317 - Loading XML bean definitions from class path resource [applicationContext-mq.xml]那

配置文件为:

因为之前没有spring里面没有amq,所以每次启动的时候都会去线上查找,所以导致会很卡

http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd 

解决方法:

    配置spring的原生bean

    将

<!-- ActiveMQ 连接工厂 -->
    <amq:connectionFactory id="amqConnectionFactory"
    brokerURL="tcp://localhost:61616" userName="admin" password="admin"  />

改为:

    <bean id="amqConnectionFactory" 
    	class="org.apache.activemq.ActiveMQConnectionFactory">
    	<property name="brokerURL" value="tcp://localhost:61616"></property>
    	<property name="userName" value="admin"></property>
    	<property name="password" value="admin"></property>
    </bean>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值