Umstellung auf Thymeleaf: Schritt 2 - Tilesunterstützung aktiviert
[website] / src / main / resources / spring / mvc.xml
index e2cdc38..87c2a01 100644 (file)
@@ -3,6 +3,7 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
@@ -10,6 +11,8 @@
            http://www.springframework.org/schema/mvc/spring-mvc-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/util
+           http://www.springframework.org/schema/util/spring-util-4.0.xsd
            ">
 
   <!-- Damit das DispatcherServlet auf /* gemappt werden kann -->
   <!-- Thymeleaf Spring-View-Resolver -->
   <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
     <property name="templateEngine" ref="templateEngine" />
+    <property name="viewNames" value="views/*,templates/*"/>
+    <property name="order" value="1"/>
+  </bean>
+
+  <!-- Thymeleaf Tiles-View-Resolver -->
+  <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+    <property name="templateEngine" ref="templateEngine" />
+    <property name="viewClass" value="org.thymeleaf.extras.tiles2.spring4.web.view.ThymeleafTilesView"/>
+    <property name="order" value="2"/>
+  </bean>
+
+
+  <!-- Thymeleaf Tiles-Configurer -->
+  <bean class="org.thymeleaf.extras.tiles2.spring4.web.configurer.ThymeleafTilesConfigurer">
+    <property name="definitions">
+      <list>
+        <value>classpath:/spring/tiles.xml</value>
+      </list>
+    </property>
+    <property name="useMutableTilesContainer" value="true"/>
   </bean>
 
 
   <!-- Thymeleaf Spring4-Template-Engine -->
   <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
     <property name="templateResolver" ref="templateResolver" />
+    <property name="additionalDialects">
+      <util:set>
+        <bean class="org.thymeleaf.extras.tiles2.dialect.TilesDialect"/>
+      </util:set>
+    </property>
   </bean>
 
 </beans>