package com.cim.idm.mwmsextend.checkrecord;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import com.cim.idm.framework.util.service.ServiceUtil;
import com.cim.idm.mwmsextend.checkrecord.management.CheckRecordService;
import com.cim.idm.mwmsextend.checkrecord.management.impl.CheckRecordServiceImpl;
@Component
public class CheckRecordServiceProxy implements ApplicationContextAware{
	
	private Log log = LogFactory.getLog(this.getClass());
	private static ApplicationContext ac ;
	
	@Override
	public void setApplicationContext(ApplicationContext context)
			throws BeansException {
		this.ac = context;
		log.debug(this.getClass().getSimpleName() +" Success Get ApplicationContext");
	}
	
	public static CheckRecordService getCheckRecordService(){
		try{
			return (CheckRecordService)ac.getBean(ServiceUtil.formatSimpleClassName(CheckRecordService.class));
		}catch(Throwable e){
			return ac.getBean(CheckRecordServiceImpl.class);
		}
	}
	
	
}