parent
24b953edf2
commit
c68ffa5ba0
|
@ -505,6 +505,11 @@
|
|||
<artifactId>thymeleaf-extras-conditionalcomments</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-java8time</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.thymeleaf.dialect.IDialect;
|
||||
import org.thymeleaf.extras.conditionalcomments.dialect.ConditionalCommentsDialect;
|
||||
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
|
||||
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
|
||||
import org.thymeleaf.spring4.SpringTemplateEngine;
|
||||
import org.thymeleaf.spring4.resourceresolver.SpringResourceResourceResolver;
|
||||
|
@ -40,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
|
@ -61,6 +63,7 @@ import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
|
|||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
* @author Brian Clozel
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ThymeleafProperties.class)
|
||||
|
@ -190,6 +193,19 @@ public class ThymeleafAutoConfiguration {
|
|||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnJava(ConditionalOnJava.JavaVersion.EIGHT)
|
||||
@ConditionalOnClass({ Java8TimeDialect.class })
|
||||
protected static class ThymeleafJava8TimeDialect {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Java8TimeDialect java8TimeDialect() {
|
||||
return new Java8TimeDialect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass({ Servlet.class })
|
||||
@ConditionalOnWebApplication
|
||||
|
|
|
@ -54,6 +54,7 @@ import static org.junit.Assert.assertTrue;
|
|||
*
|
||||
* @author Dave Syer
|
||||
* @author Stephane Nicoll
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
public class ThymeleafAutoConfigurationTests {
|
||||
|
||||
|
@ -172,6 +173,17 @@ public class ThymeleafAutoConfigurationTests {
|
|||
assertEquals("<html><body data-foo=\"bar\"></body></html>", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void useJava8TimeDialect() throws Exception {
|
||||
this.context.register(ThymeleafAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
TemplateEngine engine = this.context.getBean(TemplateEngine.class);
|
||||
Context attrs = new Context(Locale.UK);
|
||||
String result = engine.process("java8time-dialect", attrs);
|
||||
assertEquals("<html><body>2015-11-24</body></html>", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderTemplate() throws Exception {
|
||||
this.context.register(ThymeleafAutoConfiguration.class,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<html><body th:text="${#temporals.create('2015','11','24')}"></body></html>
|
|
@ -153,6 +153,7 @@
|
|||
<thymeleaf-extras-conditionalcomments.version>2.1.1.RELEASE</thymeleaf-extras-conditionalcomments.version>
|
||||
<thymeleaf-layout-dialect.version>1.3.1</thymeleaf-layout-dialect.version>
|
||||
<thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
|
||||
<thymeleaf-extras-java8time.version>2.1.0.RELEASE</thymeleaf-extras-java8time.version>
|
||||
<tomcat.version>8.0.30</tomcat.version>
|
||||
<undertow.version>1.3.14.Final</undertow.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
|
@ -1963,6 +1964,11 @@
|
|||
<artifactId>thymeleaf-extras-conditionalcomments</artifactId>
|
||||
<version>${thymeleaf-extras-conditionalcomments.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-java8time</artifactId>
|
||||
<version>${thymeleaf-extras-java8time.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||
|
|
Loading…
Reference in New Issue