zoukankan      html  css  js  c++  java
  • FreeMarker过时的方法 new Configuration()

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

    微信公众号
    在这里插入图片描述

  • 相关阅读:
    join()方法的使用
    synchronized关键字
    voliatle关键字
    一.线程概述
    NIO demo
    同步阻塞I/O
    Ubuntu16.04.1 安装Nginx
    垃圾收集
    如何从头开始安装 wordpress
    centos 6 安装 gnu c++ 等开发工具
  • 原文地址:https://www.cnblogs.com/niugang0920/p/12185870.html
Copyright © 2011-2022 走看看