@Service("commandFactory")
public class CommandFactory implements ICommandFactory,ApplicationContextAware {
private ApplicationContext applicationContext;
//private static Logger logger = LoggerFactory.getLogger(CommandFactory.class);
/**
* 功能描述:默認構造函數CommandFactory,
*/
public CommandFactory() {}
/**
* 功能描述: 核心工廠返回真正的接口實例對象
* @method:getCommandTaskType
* @param huoguObject
* @return:IMiniAdviceService
*/
public IMiniAdviceService getCommandTaskType(HuoguObject huoguObject){
return (IMiniAdviceService) applicationContext.getBean(huoguObject.getTaskType());
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public ApplicationContext getApplicationContext() {
return applicationContext;
}
}