/**
 * 
 */


package gov.va.med.cds.mediator.config;


import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;


/**
 * @author vhaislegberb
 *
 */
public class SpringApplicationContextAccessor
    implements
        ApplicationContextAware
{

    private ApplicationContext applicationContext = null;


    /* (non-Javadoc)
     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
     */
    public void setApplicationContext( ApplicationContext applicationContext )
        throws BeansException
    {
        this.applicationContext = applicationContext;
    }


    public Object getBean( String id )
    {
        Object bean = null;

        if ( this.applicationContext != null )
        {
            bean = this.applicationContext.getBean( id );
        }

        return bean;
    }
}
