package com.yunzhupaas.listener;

import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.util.RedisUtil;
import com.yunzhupaas.util.context.SpringContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 *
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司
 * @date 2024/3/16 8:49
 */
@Component
public class YunzhupaasListener implements ApplicationListener<ContextRefreshedEvent> {

    private ConfigValueUtil configValueUtil;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        configValueUtil = SpringContext.getBean(ConfigValueUtil.class);
        if ("false".equals(configValueUtil.getTestVersion())) {
            RedisUtil redisUtil = SpringContext.getBean(RedisUtil.class);
            redisUtil.removeAll();
        }
    }
}
