Bug 修复

yun-zuoyi
wei.peng 5 years ago
parent 5f9399ad88
commit 12aa1482cf

@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -35,6 +36,9 @@ public class AppStartSystemInit implements CommandLineRunner {
@Autowired @Autowired
private ISystemInitService systemInitService; private ISystemInitService systemInitService;
@Autowired
private static Environment environment;
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
public String SPRING_PROFILES_ACTIVE; public String SPRING_PROFILES_ACTIVE;
// 限制组织数量 // 限制组织数量
@ -42,8 +46,8 @@ public class AppStartSystemInit implements CommandLineRunner {
// 限制账号数量 // 限制账号数量
public static int userInfoCount = 100; public static int userInfoCount = 100;
@Value("${" + CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL + "}") // @Value("${" + CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL + "}")
public String PROP_IMPP_ELASTICSEARCH_URL; // public String PROP_IMPP_ELASTICSEARCH_URL;
@Resource(name = CommonConstWords.IMPP_REDIS_RES) @Resource(name = CommonConstWords.IMPP_REDIS_RES)
private ImppRedis redisRes; private ImppRedis redisRes;
@ -104,8 +108,9 @@ public class AppStartSystemInit implements CommandLineRunner {
public void initImppElasticSearch(){ public void initImppElasticSearch(){
try { try {
if(ImppSwitchUtil.isElasticSearchSwitch()){ if(ImppSwitchUtil.isElasticSearchSwitch()){
if(StringUtils.isNotBlank(PROP_IMPP_ELASTICSEARCH_URL)){ String rul = environment.getProperty(CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL);
ElasticSearchTool.init(PROP_IMPP_ELASTICSEARCH_URL); if(StringUtils.isNotBlank(rul)){
ElasticSearchTool.init(rul);
}else { }else {
LOGGER.info("【启动加载】启动加载 ElasticSearch 组件错误,url 参数缺失"); LOGGER.info("【启动加载】启动加载 ElasticSearch 组件错误,url 参数缺失");
} }
@ -278,4 +283,6 @@ public class AppStartSystemInit implements CommandLineRunner {
LOGGER.info("【资源配置文件已全部加载】");*/ LOGGER.info("【资源配置文件已全部加载】");*/
} }
} }

Loading…
Cancel
Save