春风项目四线(合箱线、总装线)
懒羊羊
2024-01-17 5f7e70b8132d018614e8f4989d0614bd50cb7ecb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
        }
    }
}