Преглед на файлове

模板文件读取方式修改,支持读取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);


Зареждане…
Отказ
Запис