正确关闭Spring AMQP连接的正确方法是什么
protected CachingConnectionFactory connectionFactory;
protected AmqpAdmin admin;
protected RabbitTemplate processingTemplate;
private static Class<ContextServer> applicationClass = ContextServer.class;
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// do something
}
public void close() {
connectionFactory.destroy();
admin = null;
processingTemplate = null;
}
我能想到的唯一解决方案是使用destroy。有更好的方法吗?