/*** 消费者工厂*/@EnableKafka
@Configurationpublic classKafkaConsumerFactory {
@AutowiredprivateApplicationContext context;/*** 获取消费者工厂*/
public ConsumerFactoryconsumerFactory(String kafkaBroker) {//消费者配置信息
Map props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBroker);
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, Boolean.TRUE);
props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,10);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);return new DefaultKafkaConsumerFactory<>(props);
}/*** 容器配置
*
*@paramgroupId 组名
*@paramclazz 消费者监听器
*@paramtopicName topicName
*@return容器配置*/
publicContainerProperties containerProperti