I want create a RabbitListener when a property is present, but @ConditionOnProperty cannot combine with @RabbitListener. Now I have a workaround below. Does it exist any better method?
@Bean
@ConditionalOnProperty(name = "pmc.multiple.hypervisor.reply.routerkey.kvm")
public SimpleMessageListenerContainer kvmReplyQueueConsumer() {
return getSimpleMessageListenerContainer(environment
.getProperty("pmc.multiple.hypervisor.reply.routerkey.kvm"));
}