Dynamically add new queues, bindings and exchanges as beans Dynamically add new queues, bindings and exchanges as beans spring spring

Dynamically add new queues, bindings and exchanges as beans


You can add beans dynamically to the context:

context.getBeanFactory().registerSingleton("foo", new Queue("foo"));

but they won't be declared by the admin automatically; you will have to call admin.initialize() to force it to re-declare all the AMQP elements in the context.

You would not do either of these in @Beans, just normal runtime java code.