我们使用的是Spring AMQP客户端连接到我们的RabbitMQs和我们的Spring配置定义为重写
<bean id="nativeCF" class="com.rabbitmq.client.ConnectionFactory" p:connection-timeout="#{msgProps['messaging.amqp.connection.timeout.millis']?:30000}"
p:socket-factory-ref="rabbitSslSocketFactory" p:automatic-recovery-enabled="true" p:topologyRecoveryEnabled="false"/>
<rabbit:connection-factory id="connectionFactory" host="#{msgProps['messaging.amqp.host']}"
username="#{msgProps['messaging.amqp.username']}" password="#{propertyEncryptor.decrypt(msgProps['messaging.amqp.password'])}"
port="#{msgProps['messaging.amqp.port']}" requested-heartbeat="#{msgProps['messaging.amqp.heartbeat']?:600}"
channel-cache-size="#{msgProps['messaging.amqp.channel.cache.size']?:150}" connection-factory="nativeCF"/>
- 的nativeCF指向默认org.springframework.amqp.rabbit.connection.CachingConnectionFactory实现到基本的Java客户端实现ConnectionFactory。当我调试我的代码,我看到是自动装配ConnectionFactory是(org.springframework.amqp.rabbit.connectionCachingConnectionFactory)
我想覆盖amqp.rabbit.CachingConnectionFactory并在配置自动装配它。想知道如何继续。
您是否使用Spring Boot? –
不,只有spring-amqp – user3221681