From 75abb2cee8ecdab3710a003a038f83de4c765aea Mon Sep 17 00:00:00 2001 From: zhouhao Date: Fri, 15 Sep 2017 16:35:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/starter/SystemInitializeAutoConfiguration.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java index 9aac62e1e..1bcc7bf86 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemInitializeAutoConfiguration.java @@ -18,7 +18,6 @@ package org.hswebframework.web.starter; -import org.hsweb.ezorm.rdb.RDBDatabase; import org.hsweb.ezorm.rdb.executor.SqlExecutor; import org.hsweb.ezorm.rdb.meta.RDBDatabaseMetaData; import org.hsweb.ezorm.rdb.meta.parser.H2TableMetaParser; @@ -36,7 +35,6 @@ import org.hswebframework.web.datasource.DatabaseType; import org.hswebframework.web.service.Service; import org.hswebframework.web.starter.init.SystemInitialize; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.CommandLineRunner; @@ -91,11 +89,12 @@ public class SystemInitializeAutoConfiguration implements CommandLineRunner, Bea addGlobalVariable("spring", applicationContext); } + @SuppressWarnings("all") protected void addGlobalVariable(String var, Object val) { engines.forEach(engine -> { try { engine.addGlobalVariable(Collections.singletonMap(var, val)); - } catch (Exception ignore) { + } catch (NullPointerException ignore) { } } ); @@ -140,12 +139,12 @@ public class SystemInitializeAutoConfiguration implements CommandLineRunner, Bea @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessBeforeInitialization(Object bean, String beanName) { return bean; } @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + public Object postProcessAfterInitialization(Object bean, String beanName) { ScriptScope scope; if (bean instanceof Service) { addGlobalVariable(beanName, bean);