package com.csst.microservice.mail.mustache;
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
/**
Created by Administrator on 2016/7/26.
*/
public class Example {
List items() {
return Arrays.asList(new Item("邮箱验证", "123456", "2011年01月01日"));
}
static class Item {
Item(String type, String code, String time) {
this.type = type;
this.code = code;
this.time = time;
}
String type,code,time;
}
static class Feature {
Feature(String description) {
this.description = description;
}
String description;
}
public static void main(String[] args) throws IOException, InterruptedException {
MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile("D:\csst\iotp2\core\mail\src\main\java\com\csst\microservice\mail"
+ "\mustache\template.mustache");
mustache.execute(new PrintWriter(System.out), new Example()).flush();
}
}
控制台输出:
亲爱的用户:
您好!感谢使用中安消云,您正在进行邮箱验证,本次请求的验证码为:
123456
(为了保证您账户的安全性,请尽快完成验证)
中安消云
2011年01月01日
如何用一个变量接收控制台的值