赞
踩
//kafkaTemplate实现了Kafka发送接收等功能
@Bean
@Primary
public KafkaTemplate<Integer, String> kafkaTemplate() {
KafkaTemplate template = new KafkaTemplate<Integer, String>(producerFactory());
return template;
}
@Bean("defaultKafkaTemplate")
public KafkaTemplate<Integer, String> defaultKafkaTemplate() {
KafkaTemplate template = new KafkaTemplate<Integer, String>(producerFactory());
template.setDefaultTopic("topic.quick.default");
r
package zhw.example.zhw.kafka; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; @Controller @RequestMapping(value = "kafka") public class producer { @Resource private KafkaTemplate defaultKafkaTemplate; @ResponseBody @RequestMapping(value =
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。