IClearApiSystemInit.java 1.52 KB
package com.erry.iclear.dateInterface.init;

import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;

import java.util.HashMap;
import java.util.List;

/**
 * @author Administrator
 */
@Service("IClearApiSystemInit")
@Slf4j
public class IClearApiSystemInit implements InitializingBean, ApplicationContextAware{

	private ApplicationContext applicationContext;

	@Autowired
	private IClearApiSystemService iClearApiSystemService;


	@Override
	public void setApplicationContext(ApplicationContext applicationContext)throws BeansException {
		this.applicationContext = applicationContext;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		try{
			StopWatch sw = new StopWatch("initSystemCache");
			sw.start("initCache");
			log.info("init initSystemCache start>>>>>>>>>");
			iClearApiSystemService.refreshAppInfoCache();
			log.info("init initSystemCache end>>>>>>>>>");
			sw.stop();
			log.info(sw.prettyPrint());

		}catch (Exception e){
			log.error("init afterPropertiesSet error:" + e.getMessage());
		}
	}

















}