为什么exchange和queue1会自动匹配到后面方法的参数中?是怎么匹配的呢?
package com.imooc.mall.rabbit;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class TopicRabbitConfig {
@Bean
TopicExchange exchange() {
return new TopicExchange("bootExchange");
}
@Bean
public Queue queue1() {
return new Queue("queue1");
}
@Bean
public Queue queue2() {
return new Queue("queue2");
}
@Bean
Binding bingingExchangeMessage1(Queue queue1, TopicExchange exchange) {
return BindingBuilder.bind(queue1).to(exchange).with("dog.red");
}
@Bean
Binding bingingExchangeMessage2(Queue queue2, TopicExchange exchange) {
return BindingBuilder.bind(queue2).to(exchange).with("dog.#");
}
}为什么这里的exchange和queue1 exchange和queue2 会自动匹配到后面的方法bingingExchangeMessage的参数中?
这里里面的方法有的没有修饰符,是默认的default吗?
通过@Bean方法加载到sping工厂里,public修饰的方法和不用修饰符的方法有什么不同吗?
18
收起
正在回答 回答被采纳积分+1
2回答
2023版Java工程师
- 参与学习 人
- 提交作业 8788 份
- 解答问题 9886 个
综合就业常年第一,编程排行常年霸榜,北上广深月薪过万! 不需要基础,无需脱产即可学习,只要你有梦想,想高薪! 全新升级:技术栈升级(包含VUE3.0,ES6,Git)+项目升级(前后端联调与功能升级)
了解课程


恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星