반응형
ㅁ 타임리프를 스프링에 맞춰보자
  1. xml 설정 (예제에서는 webconfig.java를 만들어서 설정을 bean으로 다 추가 했다)
        아래는 xml에 추가해야 될 부분
<!-- SpringResourceTemplateResolver automatically integrates with Spring's own --><!-- resource resolution infrastructure, which is highly recommended. --><bean id="templateResolver"
class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
<property name="prefix" value="/WEB-INF/templates/" />
<property name="suffix" value=".html" />
<!-- HTML is the default value, added here for the sake of clarity. -->
<property name="templateMode" value="HTML" />
<!-- Template cache is true by default. Set to false if you want -->
<!-- templates to be automatically updated when modified. -->
<property name="cacheable" value="true" /></bean>
<!-- SpringTemplateEngine automatically applies SpringStandardDialect and --><!-- enables Spring's own MessageSource message resolution mechanisms. --><bean id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<!-- Enabling the SpringEL compiler with Spring 4.2.4 or newer can speed up -->
<!-- execution in most scenarios, but might be incompatible with specific -->
<!-- cases when expressions in one template are reused across different data -->
<!-- ypes, so this flag is "false" by default for safer backwards -->
<!-- compatibility. -->

<property name="enableSpringELCompiler" value="true" /></bean>


반응형

+ Recent posts