Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. @Configuration
  2. public class serverConfiguration {
  3. private String queueName;
  4. ...
  5. @Bean
  6. public Queue buildQueue() {
  7. Queue queue = new Queue(this.queueName, false, false, true, getQueueArguments());
  8. buildRabbitAdmin().declareQueue(queue);
  9. return queue;
  10. }
  11. ...
  12. }
  13.  
  14. @Configuration
  15. public class serverConfiguration {
  16. private String queueName;
  17. ...
  18. @Bean
  19. @Scope("prototype")
  20. public Queue buildQueue() {
  21. Queue queue = new Queue(this.queueName, false, false, true, getQueueArguments());
  22. buildRabbitAdmin().declareQueue(queue);
  23. return queue;
  24. }
  25. ...
  26. }
  27.  
  28. Map<String, Queue> queueBeans = ((ListableBeanFactory) applicationContext).getBeansOfType(Queue.class);
  29.  
  30. name of the method := the last created instance.
  31.  
  32. context.getBeanFactory().registerSingleton("foo", new Queue("foo"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement