Quellcode durchsuchen

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

master
郑根木 vor 2 Jahren
Ursprung
Commit
3ea96939f4
1 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  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 Datei anzeigen

@@ -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);


Laden…
Abbrechen
Speichern