瀏覽代碼

Update ConfigurerFreeMarker.java

MaxKey 11 月之前
父節點
當前提交
e8057b4661
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      maxkey-core/src/main/java/org/dromara/maxkey/web/ConfigurerFreeMarker.java

+ 4 - 6
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<String, Object> 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<String, Object> entry : map.entrySet()) {
+			configuration.setSharedVariable(entry.getKey(), entry.getValue());
+			_logger.trace("FreeMarker Template {}" , entry.getKey());
 		}
 
 	}