From 12aa1482cf0fb3fa39f3d2e4478623a08f95a035 Mon Sep 17 00:00:00 2001 From: "wei.peng" <123456> Date: Wed, 8 Apr 2020 10:01:51 +0800 Subject: [PATCH] =?UTF-8?q?Bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/apiservice/configuration/AppStartSystemInit.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/configuration/AppStartSystemInit.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/configuration/AppStartSystemInit.java index 93357ed..662e0d4 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/configuration/AppStartSystemInit.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/configuration/AppStartSystemInit.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -35,6 +36,9 @@ public class AppStartSystemInit implements CommandLineRunner { @Autowired private ISystemInitService systemInitService; + @Autowired + private static Environment environment; + @Value("${spring.profiles.active}") public String SPRING_PROFILES_ACTIVE; // 限制组织数量 @@ -42,8 +46,8 @@ public class AppStartSystemInit implements CommandLineRunner { // 限制账号数量 public static int userInfoCount = 100; - @Value("${" + CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL + "}") - public String PROP_IMPP_ELASTICSEARCH_URL; +// @Value("${" + CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL + "}") +// public String PROP_IMPP_ELASTICSEARCH_URL; @Resource(name = CommonConstWords.IMPP_REDIS_RES) private ImppRedis redisRes; @@ -104,8 +108,9 @@ public class AppStartSystemInit implements CommandLineRunner { public void initImppElasticSearch(){ try { if(ImppSwitchUtil.isElasticSearchSwitch()){ - if(StringUtils.isNotBlank(PROP_IMPP_ELASTICSEARCH_URL)){ - ElasticSearchTool.init(PROP_IMPP_ELASTICSEARCH_URL); + String rul = environment.getProperty(CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL); + if(StringUtils.isNotBlank(rul)){ + ElasticSearchTool.init(rul); }else { LOGGER.info("【启动加载】启动加载 ElasticSearch 组件错误,url 参数缺失"); } @@ -278,4 +283,6 @@ public class AppStartSystemInit implements CommandLineRunner { LOGGER.info("【资源配置文件已全部加载】");*/ } + + }