首页 > 其他分享 >Kafka在本地环境下不消费数据

Kafka在本地环境下不消费数据

时间:2023-04-03 14:11:42浏览次数:38  
标签:消费 String UAT private Kafka environment springframework 本地 import

package com.test.core.condition;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListenerAnnotationBeanPostProcessor;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class KafkaBeanDefinitionRegistryPostProcessor extends KafkaListenerAnnotationBeanPostProcessor {



    @Value("${spring.profiles.active}")
    private String environment;
    private final String UAT="uat";
    private final String PROD="prod";
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
//只在UAT和PROD下消费数据 if (UAT.equals(environment)||PROD.equals(environment)) { return bean; } return null; } }

 

标签:消费,String,UAT,private,Kafka,environment,springframework,本地,import
From: https://www.cnblogs.com/tiancai/p/17282899.html

相关文章