WIP
[website] / src / main / resources / spring / mvc.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4        xmlns:mvc="http://www.springframework.org/schema/mvc"
5        xmlns:context="http://www.springframework.org/schema/context"
6        xmlns:util="http://www.springframework.org/schema/util"
7        xsi:schemaLocation="
8            http://www.springframework.org/schema/beans
9            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
10            http://www.springframework.org/schema/mvc
11            http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
12            http://www.springframework.org/schema/context
13            http://www.springframework.org/schema/context/spring-context-3.1.xsd
14            http://www.springframework.org/schema/util
15            http://www.springframework.org/schema/util/spring-util-4.0.xsd
16            ">
17
18   <!-- Resolve application-parameters through java-systemproperties -->
19   <context:property-placeholder location="classpath:website.properties" />
20
21   <!-- Necesarry, to map the DispatcherServlet on /* -->
22   <mvc:default-servlet-handler/>
23   <mvc:view-controller path="/" view-name="index"/>
24
25   <!-- Scann classpath for classes anntated as components -->
26   <context:component-scan base-package="de.juplo.website"/>
27
28   <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
29     <property name="mappings">
30       <value>
31         /thymeleaf/**=staticResources
32         /*.html=urlFilenameViewController
33         /**/*.html=urlFilenameViewController
34       </value>
35     </property>
36     <property name="order" value="10"/>
37   </bean>
38   <bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
39   <bean id="staticResources" class="org.springframework.web.servlet.resource.ResourceHttpRequestHandler">
40     <property name="locations">
41       <list>
42         <value>/thymeleaf/</value>
43       </list>
44     </property>
45   </bean>
46
47   <!-- Thymeleaf Spring-View-Resolver -->
48   <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
49     <property name="templateEngine" ref="templateEngine" />
50     <property name="characterEncoding" value="UTF-8" />
51     <property name="contentType" value="text/html; charset=UTF-8" />
52   </bean>
53
54
55   <!-- Thymeleaf Template-Resolver -->
56   <bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
57     <property name="prefix" value="/thymeleaf/" />
58     <property name="suffix" value=".html" />
59     <property name="templateMode" value="HTML5" />
60     <property name="characterEncoding" value="UTF-8" />
61     <property name="cacheable" value="${website.cacheable}" />
62   </bean>
63
64   <!-- Thymeleaf Spring4-Template-Engine -->
65   <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
66     <property name="templateResolver" ref="templateResolver" />
67     <property name="additionalDialects">
68       <util:set>
69         <bean class="nz.net.ultraq.thymeleaf.LayoutDialect"/>
70         <bean class="org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect"/>
71         <bean class="de.juplo.thymeproxy.ThymeproxyDialect"/>
72         <bean class="de.juplo.thymeleaf.JuploDialect"/>
73       </util:set>
74     </property>
75   </bean>
76
77 </beans>