maven打jar包並將依賴包打進去


在使用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");

微信公眾號
在這里插入圖片描述


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM