<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC
    "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

<!--
	=========================================
	Copyright © 2004 VHA. All rights reserved
	=========================================
	
	@description: This file serves as a parrent application context of either the UI component's
	application context or the Messaging component's application context.  This fille is automatically
	loaded by AbstractMessageDriveBean, AbstractTransactionalDataSourceSpringContextTests spring class.
	
	@project: Common
	@author: DNS   LEV
	@version: 1.3
	
-->
<beans default-lazy-init="false">
	<!-- 
		@description: Loads the main application context file of the common module 
		as a resource in a class path.  		
	-->
	<bean 
		id="common.ApplicationContext" 
		class="org.springframework.context.support.ClassPathXmlApplicationContext"
		lazy-init="false" >
		
		<constructor-arg>
			<list>
				<!-- Specify a fully qualified path of a resource in a jar file -->
				<value>classpath:commons/applicationContext.xml</value>
			</list>
		</constructor-arg>
	</bean>		
	
	<!-- 
		@description: Sets the main application context file of the common module 
		as a default context.  This is needed for non-spring components in Common 
		project that obtain Spring context through a traditional singleton pattern
		via a SingletonApplicationContext.getSingletonContext()
	-->
	<bean
		id="singletonContextInstaller" 
		class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
	    lazy-init="false">
		
		<property name="targetObject" ref="singletonContextLocator"/>
		<property name="targetMethod" value="setSingletonContext"/>
		<property name="arguments">
		    <list>
				<ref bean="common.ApplicationContext"/>
			</list>
		</property>
	</bean>
	
	<!--
		A singleton context locator to load a common context
		
		SingletonApplicationContextUtils.getInstance();
	-->	
    <bean 
        id="singletonContextLocator"
		lazy-init="false"
        class="gov.va.med.fw.service.config.SingletonApplicationContext"
        factory-method="getInstance"/>
	
</beans>