package com.jcdm.generator.util; import java.util.Properties; import org.apache.velocity.app.Velocity; import com.jcdm.common.constant.Constants; /** * VelocityEngine工厂 * * @author jc */ public class VelocityInitializer { /** * åˆå§‹åŒ–vm方法 */ public static void initVelocity() { Properties p = new Properties(); try { // åŠ è½½classpath目录下的vm文件 p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); // 定义å—符集 p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); // åˆå§‹åŒ–Velocity引擎,指定é…ç½®Properties Velocity.init(p); } catch (Exception e) { throw new RuntimeException(e); } } }