<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	   xmlns:webflow="http://www.springframework.org/schema/webflow-config" 
	   xmlns:context="http://www.springframework.org/schema/context" 
	   xmlns:mvc="http://www.springframework.org/schema/mvc"
	   xmlns:aop="http://www.springframework.org/schema/aop" 
	   xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/webflow-config
        http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    <!-- =========================================================================================================== -->
    
    <!-- maps requests to request mappings within annotated controllers, not entirely sure this is needed -->
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        <property name="order" value="1"/>
    </bean>

    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions" value="/xml/spring/tiles.xml,/xml/national/spring/tiles.xml"/>
    </bean>
    
    <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
    </bean>
    
    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <!--  Locale Beans -->
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" autowire-candidate="true">
        <property name="basenames">
            <list>
                <value>WEB-INF/classes/resources</value>
                <value>WEB-INF/classes/navigation</value>
                <value>classpath:properties/gov/va/med/pharmacy/peps/common/exception/FieldKey</value>
                <value>classpath:properties/validation/FieldError</value>
                <value>classpath:properties/validation/ValidationErrors</value>
                <value>classpath:properties/gov/va/med/pharmacy/peps/presentation/common/springwebflow/breadcrumbs/Breadcrumb</value>
                <value>classpath:properties/gov/va/med/pharmacy/peps/common/vo/FieldKey</value>
            </list>
        </property>
    </bean>

    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
        <property name="defaultLocale" value="en_US"/>
    </bean>
    
    <!-- Spring Interceptors -->
    <mvc:interceptors>        
        <bean id="contentCacheInterceptor" class="gov.va.med.pharmacy.peps.presentation.common.spring.interceptor.ContentCacheInterceptor" />
        <bean id="menuTabDisplayInterceptor" class="gov.va.med.pharmacy.peps.presentation.common.spring.interceptor.MenuTabDisplayInterceptor" />
        <bean id="securityInterceptor" class="gov.va.med.pharmacy.peps.presentation.common.spring.interceptor.SecurityInterceptor" />     
    	<bean id="beanScopeInterceptor" class="gov.va.med.pharmacy.peps.presentation.common.pagetrail.BeanScopeInterceptor" />
        <bean id="springFieldAuthorizationInterceptor" class="gov.va.med.pharmacy.peps.presentation.common.spring.interceptor.FieldAuthorizationSpringInterceptor">
            <property name="userService" ref="userService"/>
        </bean>
        <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
    </mvc:interceptors>

    <!-- find controllers, components, etc. -->
    <context:component-scan base-package="gov.va.med.pharmacy.peps.presentation.common"/>
    <context:component-scan base-package=" gov.va.med.pharmacy.peps.common.vo.validator"/>
    <context:annotation-config/>    
 
    <mvc:annotation-driven conversion-service="conversionService"/>
    
    <!--  type converters -->
    <import resource="PresentationTypeConverters.xml" />
    
       
	<bean id="migrationController" class="gov.va.med.pharmacy.peps.presentation.common.controller.migration.MigrationController">
		<property name="migrationService" ref="migrationService"/>
		<property name="migrationCSVService" ref="migrationCSVService"/>
	</bean>
			
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    	<!-- one of the properties available; the maximum file size in bytes -->
    	<property name="maxUploadSize" value="20000000"/>
	</bean>

	<bean id="reportsController" class="gov.va.med.pharmacy.peps.presentation.common.controller.ReportsController">
		<property name="reportsService" ref="reportsService"/>
	</bean>
</beans>