package com.ejie.ad74a.util.comun;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * Clase para tener accesible el contexto de Spring desde cualquier sitio
 * 
 * @author jbhg
 *
 */
@Component
public class ApplicationContextProvider implements ApplicationContextAware {
	private static ApplicationContextProvider instance = new ApplicationContextProvider();
	private ApplicationContext applicationContext;

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) {
		instance.applicationContext = applicationContext;
	}

	public static ApplicationContext getApplicationContext() {
		return instance.applicationContext;
	}
}