Spring Cloud 2 使用 starter-stream-kafka
spring-cloud-starter-stream-kafka 2.X的配置很少有被讲到,但这又是springcloud架构中很重要的一块,这里做一下介绍使用,抛砖引玉。 关于新的配置项可以查询m2文件夹下的路劲: .m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.3.RELEASE\spring-boot-autoconfigure-2.1.3.RELEASE.jar!\META-INF\spring-configuration-metadata.json 该文件有全面的spring cloud 2配置 项目中的yml配置简单点只需要 spring: application: name: spring-producer kafka: bootstrap-servers: zhy.cauchy8389.com:9092 可以见一个service 用作sender public interface SendService { @Output("myInput") SubscribableChannel sendOrder(); } 然后在controller里面就可以这么使用 @Autowired SendService sendService; @RequestMapping(value