📜  thymeleaf 表达式对象方言 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:05.213000             🧑  作者: Mango

代码示例1
public class MyDialect extends AbstractDialect implements IExpressionEnhancingDialect {

  public MyDialect() {
    super();
  }

  @Override
  public String getPrefix() {
    // @see org.thymeleaf.dialect.IDialect#getPrefix
    return "xxx";
  }

  @Override
  public boolean isLenient() {
    return false;
  }

  @Override
  public Map getAdditionalExpressionObjects(IProcessingContext ctx) {
    Map expressions = new HashMap<>();
    expressions.put("labels", new LabelUtil());
    return expressions;
  }
}
@Configuration
public class ThymeleafConfig {

  @Bean
  public MyDialect myDialect() {
    return new MyDialect();
  }
}