<?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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.2.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

    <!-- **************************************************************** -->
    <!-- RESOURCE FOLDERS CONFIGURATION -->
    <!-- Dispatcher configuration for serving static resources -->
    <!-- **************************************************************** -->
    <mvc:resources location="/static/" mapping="/static/**" />
    <mvc:resources location="/lib/" mapping="/lib/**" />
    <mvc:resources location="/_firebug/" mapping="/_firebug/**" />
    <!--mvc:resources location="/css/" mapping="/css/**" /-->

    <!-- **************************************************************** -->
    <!-- SPRING ANNOTATION PROCESSING -->
    <!-- **************************************************************** -->
    <mvc:annotation-driven>
	    <mvc:argument-resolvers>
	        <bean class="org.springframework.data.web.PageableArgumentResolver">
	           <property name="prefix" value="p"/>
	        </bean>
	    </mvc:argument-resolvers>
    </mvc:annotation-driven>
    <mvc:interceptors>
        <bean class="org.iri_research.renkan.controller.VersionHandlerInterceptor"/>
    </mvc:interceptors>

    <context:component-scan
        base-package="org.iri_research.renkan.controller" />
         
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
        <property name="order" value="2" />
        <property name="redirectHttp10Compatible" value="false" />
    </bean>
    
    <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
        <property name="prefix" value="/WEB-INF/templates/" />
        <property name="suffix" value=".html" />
        <property name="templateMode" value="HTML5" />
        <property name="characterEncoding" value="UTF-8" />
        <property name="cacheable" value="false"/>
    </bean>
    
    <bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
        <property name="templateResolver" ref="templateResolver" />
        <property name="additionalDialects">
            <set>
              <bean class="org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect"/>
            </set>
      </property>
    </bean>

    <bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
        <property name="templateEngine" ref="templateEngine" />
        <property name="order" value="1" />
        <!--property name="viewNames" value="*.html,*.xhtml" /-->
        <property name="characterEncoding" value="UTF-8"/>
        <property name="redirectHttp10Compatible" value="false" />
    </bean>
</beans>