在使用FreeMarker創建Configuration對象時,提示過期
//freemarker包
Configuration configuration = new Configuration()~;
查看源碼發現,通過此方式獲得一個Configuration實例,需要一個版本信息
就是說現在你要獲得一個 Configuration實例需要一個版本實例,目前我的版本是2.3.23
Use Configuration(Version) instead.Version是一個靜態字段
Configuration.VERSION_2_3_23 是一個靜態字段
//freemarker包
Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
//設置模板加載文件夾
configuration.setDirectoryForTemplateLoading(new File(ResourceUtils.getURL("classpath:").getPath() + "template"));
//設置模板
Template template = configuration.getTemplate("mail.ftl");
微信公眾號