瀏覽代碼

模板文件读取方式修改,支持读取jar中文件

master
郑根木 2 年之前
父節點
當前提交
3ea96939f4
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java

+ 4
- 3
smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java 查看文件

@@ -31,17 +31,18 @@ public class CodeGenerator {

private final String encode = org.apache.commons.codec.CharEncoding.UTF_8;
//模板文件所在目录
private String templatesDir;
// private String templatesDir;

//模板信息
private SwMap mapTemplate;

protected CodeGenerator() {
templatesDir = this.getClass().getResource("/static/template").getPath();
// templatesDir = this.getClass().getResource("/static/template").getPath();
mapTemplate = YamlUtil.readValue(this.getClass().getResourceAsStream("/static/template/index.yaml"), SwMap.class);
configuration = new Configuration(Configuration.VERSION_2_3_31);
try {
configuration.setDirectoryForTemplateLoading(new File(templatesDir));
configuration.setClassForTemplateLoading(this.getClass(), "/static/template/");
// configuration.setDirectoryForTemplateLoading(new File(templatesDir));
configuration.setClassicCompatible(true);
configuration.setDefaultEncoding(encode);
configuration.setOutputEncoding(encode);


Loading…
取消
儲存