diff --git a/maxkey-core/src/main/java/org/dromara/maxkey/web/ConfigurerFreeMarker.java b/maxkey-core/src/main/java/org/dromara/maxkey/web/ConfigurerFreeMarker.java index b8ad9752..4a16d536 100644 --- a/maxkey-core/src/main/java/org/dromara/maxkey/web/ConfigurerFreeMarker.java +++ b/maxkey-core/src/main/java/org/dromara/maxkey/web/ConfigurerFreeMarker.java @@ -17,7 +17,6 @@ package org.dromara.maxkey.web; -import java.io.IOException; import java.util.Map; @@ -42,15 +41,14 @@ public class ConfigurerFreeMarker implements ApplicationContextAware { @Autowired Configuration configuration; - @PostConstruct // 在项目启动时执行方法 - public void setSharedVariable() throws IOException, TemplateException { + public void setSharedVariable() throws TemplateException { // 根据注解FreemarkerTag获取bean ,key is bean name ,value is bean object Map map = this.applicationContext.getBeansWithAnnotation(FreemarkerTag.class); - for (String key : map.keySet()) { - configuration.setSharedVariable(key, map.get(key)); - _logger.trace("FreeMarker Template "+key); + for (Map.Entry entry : map.entrySet()) { + configuration.setSharedVariable(entry.getKey(), entry.getValue()); + _logger.trace("FreeMarker Template {}" , entry.getKey()); } }