|
@@ -30,9 +30,7 @@ import org.hsweb.ezorm.rdb.render.dialect.OracleRDBDatabaseMetaData;
|
|
|
import org.hsweb.ezorm.rdb.simple.SimpleDatabase;
|
|
|
import org.hswebframework.expands.script.engine.DynamicScriptEngine;
|
|
|
import org.hswebframework.expands.script.engine.DynamicScriptEngineFactory;
|
|
|
-import org.hswebframework.web.AopUtils;
|
|
|
import org.hswebframework.web.ScriptScope;
|
|
|
-import org.hswebframework.web.dao.Dao;
|
|
|
import org.hswebframework.web.datasource.DataSourceHolder;
|
|
|
import org.hswebframework.web.datasource.DatabaseType;
|
|
|
import org.hswebframework.web.service.Service;
|
|
@@ -44,7 +42,6 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.core.Ordered;
|
|
|
import org.springframework.core.annotation.AnnotationUtils;
|
|
@@ -52,10 +49,8 @@ import org.springframework.core.annotation.Order;
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
-import javax.script.ScriptEngine;
|
|
|
import javax.sql.DataSource;
|
|
|
import java.sql.Connection;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
@@ -145,10 +140,11 @@ public class SystemInitializeAutoConfiguration implements CommandLineRunner, Bea
|
|
|
|
|
|
@Override
|
|
|
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
|
|
+ ScriptScope scope;
|
|
|
if (bean instanceof Service) {
|
|
|
addGlobalVariable(beanName, bean);
|
|
|
- } else if (AnnotationUtils.findAnnotation(ClassUtils.getUserClass(bean), ScriptScope.class) != null) {
|
|
|
- addGlobalVariable(beanName, bean);
|
|
|
+ } else if ((scope = AnnotationUtils.findAnnotation(ClassUtils.getUserClass(bean), ScriptScope.class)) != null) {
|
|
|
+ addGlobalVariable(!scope.value().isEmpty() ? scope.value() : beanName, bean);
|
|
|
}
|
|
|
return bean;
|
|
|
}
|