@Override
  protected void processProperties(
      ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
      throws BeansException {
    /*
     * 覆盖父类的方法,截取解析到的参数值,放入自定义的map中,供外部调用。
     */

    // build the properties we need
    Map<String, String> tempProps = new HashMap<String, String>(props.size());
    PropertyPlaceholderHelper helper =
        new PropertyPlaceholderHelper(DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX);
    for (Object keyObj : props.keySet()) {
      String key = String.valueOf(keyObj);
      String value = props.getProperty(key);
      if (StringUtils.hasText(value) && value.startsWith(SECRET_PREFIX)) {
        try {
          String tmp = CryptoUtil.decryptApi(value.substring(SECRET_PREFIX.length()));
          value = tmp;
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      value = helper.replacePlaceholders(value, props);
      tempProps.put(key, value);
      props.setProperty(key, value);
    }
    // 这个map只读
    this.resolvedProps = Collections.unmodifiableMap(tempProps);
    PropsUtil.setProperties(resolvedProps);

    // 必须放在后面执行, 否则在xml配置属性的时候会不可用
    super.processProperties(beanFactoryToProcess, props);
  }
 @Override
 protected void processProperties(
     ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
     throws BeansException {
   this.properties = props;
   super.processProperties(beanFactoryToProcess, this.properties);
 }
 protected void processProperties(
     ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
     throws BeansException {
   super.processProperties(beanFactoryToProcess, props);
   resolvedProps = new HashMap<String, String>();
   for (Object key : props.keySet()) {
     String keyStr = key.toString();
     resolvedProps.put(keyStr, resolvePlaceholder(keyStr, props));
   }
 }
 @SuppressWarnings("static-access")
 @Override
 protected void processProperties(
     ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
     throws BeansException {
   if (!props.isEmpty()) {
     this.props = props;
   }
   super.processProperties(beanFactoryToProcess, props);
 }
 @Override
 protected void processProperties(
     ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
     throws BeansException {
   String env = System.getProperty("ENV_MODE");
   logger.info("ENV_MODE is " + env);
   Properties appConfig = PropertiesHolder.INSTANCE.getAppConfig();
   mergeProperties(props, appConfig);
   super.processProperties(beanFactoryToProcess, appConfig);
 }
  protected void processProperties(
      ConfigurableListableBeanFactory beanFactory, java.util.Properties props)
      throws BeansException {

    super.processProperties(beanFactory, props);
    for (Object key : props.keySet()) {
      String keyStr = key.toString();
      String value = props.getProperty(keyStr);
      ConstantBusiKeys.GLOBAL_CONFIG_PROPERTIES.put(keyStr, value);
    }
  }
 protected void processProperties(
     ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
     throws BeansException {
   Iterator<String> keys = AppConstants.config.getKeys();
   while (keys.hasNext()) {
     String key = keys.next();
     String value = AppConstants.config.getString(key);
     props.put(key, value);
   }
   super.processProperties(beanFactoryToProcess, props);
 }
Exemplo n.º 8
0
  @Override
  protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
      throws BeansException {
    super.processProperties(beanFactory, props);

    propertiesMap = new HashMap<String, String>();
    for (Object key : props.keySet()) {
      String keyStr = key.toString();
      String valueStr = resolvePlaceholder(keyStr, props, springSystemPropertiesMode);
      propertiesMap.put(keyStr, valueStr);
    }
  }