我正在使用 Spring Boot,我想添加 IE conditional comments Thymeleaf dialect .
我已将它包含在我的 maven pom.xml 中,但它不起作用。我如何告诉 Thymeleaf 使用它?
最佳答案
注意:在尝试之前,请注意更高版本的 Spring Boot 包含一些开箱即用的常见方言。见@Robert Hunt 的 answer .否则:
有一个例子here添加方言 bean,Spring Boot 将自动检测和使用(参见 LayoutDialect 代码和 ThymeleafDefaultConfiguration 类的方言成员)。在您的情况下,在您的 @Configuration
类之一中添加以下内容:
@Bean
public ConditionalCommentsDialect conditionalCommentDialect() {
return new ConditionalCommentsDialect();
}
Spring Boot,在 ThymeleafAutoConfiguration 类中,会自动添加任何实现 IDialect 接口(interface)的 Bean。
关于spring - 如何在 Spring Boot 中添加 thymeleaf 方言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23531580/