DynamicConfigService.java
859 Bytes
package com.yoho.search.consumer.common;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.core.config.ConfigReader;
import com.yoho.search.consumer.suggests.common.KeywordType;
@Component
public class DynamicConfigService {
@Autowired
private ConfigReader configReader;
/**
* 全球购融合到有货是否开启
*
* @return
*/
public boolean isTblToYohoOpen() {
return configReader.getBoolean("search.degrade.consumer.adaptor.tbltoyoho.open", false);
}
public boolean suggestKeywordTypeOpen(KeywordType keywordType) {
String globleEnabledKey = keywordType.getGlobleEnabledKey();
if (StringUtils.isBlank(globleEnabledKey)) {
return true;
}
return configReader.getBoolean(globleEnabledKey, true);
}
}