servlet-context.xml

60 lines | 2.491 kB Blame History Raw Download
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<!-- DispatcherServlet Context: defines this servlet's request-processing 
		infrastructure -->

	<!-- Enables the Spring MVC @Controller programming model -->
	<annotation-driven />

	<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
		up static resources in the ${webappRoot}/resources directory -->
	<resources mapping="/resources/**" location="/resources/" />

	<!-- Resolves views selected for rendering by @Controllers to .jsp resources 
		in the /WEB-INF/views directory -->
	<beans:bean id="templateResolver"
		class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="suffix" value=".html" />
		<beans:property name="templateMode" value="HTML5" />
	</beans:bean>

	<beans:bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
		<beans:property name="templateResolver" ref="templateResolver" />
		<beans:property name="additionalDialects">
			<beans:set>
				<beans:bean class="nz.net.ultraq.thymeleaf.LayoutDialect" />
			</beans:set>
		</beans:property>
	</beans:bean>

	<beans:bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
		<beans:property name="templateEngine" ref="templateEngine" />
		<beans:property name="order" value="1" />
	</beans:bean>

	<beans:bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="order" value="2" />
		<beans:property name="suffix" value=".html" />
	</beans:bean>

	<beans:bean name="main" class="org.thymeleaf.spring3.view.ThymeleafView">
		<beans:property name="staticVariables">
			<beans:map>
				<beans:entry key="footer" value="Some company: &lt;b&gt;ACME&lt;/b&gt;" />
			</beans:map>
		</beans:property>
	</beans:bean>

	<context:component-scan base-package="eu.cloudscale.showcase.servlets" />

</beans:beans>