프로그래밍 TIP/Spring

[Thymeleaf] POM.xml 설정

여름나라겨울이야기 2015. 9. 2. 22:15
728x90

<!-- thymeleaf -->

<dependency>

<groupId>org.thymeleaf</groupId>

<artifactId>thymeleaf-spring4</artifactId>

<version>2.1.4.RELEASE</version>

</dependency>


<!-- thymeleaf need servlet API for compiling the classes. Not needed in runtime -->

<!-- Servlet -->

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>javax.servlet-api</artifactId>

<version>3.1.0</version>

<scope>provided</scope>

</dependency>



http://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#views-and-view-resolvers-in-spring-mvc

<bean id="templateResolver"
      class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
  <property name="suffix" value=".html" />
  <property name="templateMode" value="HTML5" />
</bean>
<bean id="templateEngine"
      class="org.thymeleaf.spring4.SpringTemplateEngine">
  <property name="templateResolver" ref="templateResolver" />
</bean>
<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
  <property name="templateEngine" ref="templateEngine" />
  <property name="order" value="1" />
  <property name="viewNames" value="*.html,*.xhtml" />
</bean>
<bean name="main" class="org.thymeleaf.spring4.view.ThymeleafView">
  <property name="staticVariables">
    <map>
      <entry key="footer" value="Some company: &lt;b&gt;ACME&lt;/b&gt;" />
    </map>
  </property>
</bean>



기본 뷰 위치

"classpath:resources/templates/"


반응형