<?xml version="1.0" encoding="UTF-8"?>

<!--
========================================================================================================================
beans-web.xml

Copyright (c) 2013 Manning Publications Co.

Willie Wheeler (willie.wheeler@gmail.com)

Book: http://manning.com/wheeler/
Blog: http://springinpractice.com/
Code: https://github.com/springinpractice
========================================================================================================================
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/mvc
		http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
		
	<mvc:default-servlet-handler />
	
	<mvc:annotation-driven conversion-service="conversionService" />
	
	
	<!-- =========================================================================================================== -->
	<!-- Controllers                                                                                                 -->
	<!-- =========================================================================================================== -->
	
	<mvc:view-controller path="/" view-name="home" />
	<mvc:view-controller path="/login" view-name="login" />
	<mvc:view-controller path="/accessdenied" view-name="accessDenied" />
	
	<context:component-scan base-package="com.springinpractice.ch13.helpdesk.web.controller" />
	<context:component-scan base-package="com.springinpractice.ch13.sitemap.web.interceptor" />
	
	<mvc:interceptors>
		<ref bean="sitemapHandlerInterceptor" />
	</mvc:interceptors>
	
	
	<!-- =========================================================================================================== -->
	<!-- Views                                                                                                       -->
	<!-- =========================================================================================================== -->
	
	<!-- Tiles -->
	<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
		<property name="definitions">
			<list>
				<value>/WEB-INF/tiles/**/*.xml</value>
			</list>
		</property>
		
		<!-- Initialize expression language support for use in Tiles definitions. -->
		<property name="tilesProperties">
			<props>
				<prop key="org.apache.tiles.evaluator.AttributeEvaluator">org.apache.tiles.evaluator.el.ELAttributeEvaluator</prop>
			</props>
		</property>        
	</bean>
	
	<bean class="org.springframework.web.servlet.view.tiles2.TilesViewResolver" />
	
	
	<!-- =========================================================================================================== -->
	<!-- Other assorted goodies                                                                                      -->
	<!-- =========================================================================================================== -->
	
	<context:component-scan base-package="com.springinpractice.ch13.helpdesk.formatter" />
	
	<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
		<property name="formatters">
			<set>
				<ref bean="ticketCategoryFormatter" />
			</set>
		</property>
	</bean>
	
	<bean id="messageSource"
		class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
		p:basename="classpath:/spring/messages" />
</beans>
