org.springframework.beans.factory.config.YamlPropertiesFactoryBean.afterPropertiesSet()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.springframework.beans.factory.config.YamlPropertiesFactoryBean.afterPropertiesSet()方法的一些代码示例,展示了YamlPropertiesFactoryBean.afterPropertiesSet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPropertiesFactoryBean.afterPropertiesSet()方法的具体详情如下:
包路径:org.springframework.beans.factory.config.YamlPropertiesFactoryBean
类名称:YamlPropertiesFactoryBean
方法名:afterPropertiesSet

YamlPropertiesFactoryBean.afterPropertiesSet介绍

暂无

代码示例

代码示例来源:origin: spring-io/initializr

private static Properties loadProperties(Resource resource) {
  YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
  yamlFactory.setResources(resource);
  yamlFactory.afterPropertiesSet();
  return yamlFactory.getObject();
}

代码示例来源:origin: spring-cloud/spring-cloud-dataflow

private static void contributeDefaults(Map<String, Object> defaults, Resource resource) {
  if (resource.exists()) {
    YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
    yamlPropertiesFactoryBean.setResources(resource);
    yamlPropertiesFactoryBean.afterPropertiesSet();
    Properties p = yamlPropertiesFactoryBean.getObject();
    for (Object k : p.keySet()) {
      String key = k.toString();
      defaults.put(key, p.get(key));
    }
  }
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-server-core

private static void contributeDefaults(Map<String, Object> defaults, Resource resource) {
  if (resource.exists()) {
    YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
    yamlPropertiesFactoryBean.setResources(resource);
    yamlPropertiesFactoryBean.afterPropertiesSet();
    Properties p = yamlPropertiesFactoryBean.getObject();
    for (Object k : p.keySet()) {
      String key = k.toString();
      defaults.put(key, p.get(key));
    }
  }
}

代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli

private static Properties getPropertiesFromRawYaml(String raw) {
  if (StringUtils.isEmpty(raw)) {
    return new Properties();
  }
  Resource resource = new ByteArrayResource(raw.getBytes());
  YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean();
  ypfb.setResources(resource);
  ypfb.afterPropertiesSet();
  return ypfb.getObject();
}

代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli

private static Properties getPropertiesFromRawYaml(String raw) {
  if (StringUtils.isEmpty(raw)) {
    return new Properties();
  }
  Resource resource = new ByteArrayResource(raw.getBytes());
  YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean();
  ypfb.setResources(resource);
  ypfb.afterPropertiesSet();
  return ypfb.getObject();
}

代码示例来源:origin: spring-cloud/spring-cloud-dataflow

YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new FileSystemResource(propertiesFile));
yamlPropertiesFactoryBean.afterPropertiesSet();
props = yamlPropertiesFactoryBean.getObject();

代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-rest-resource

YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new FileSystemResource(propertiesFile));
yamlPropertiesFactoryBean.afterPropertiesSet();
props = yamlPropertiesFactoryBean.getObject();

代码示例来源:origin: org.apereo.cas/cas-server-core-configuration-api

/**
   * Load yaml properties map.
   *
   * @param resource the resource
   * @return the map
   */
  public static Map loadYamlProperties(final Resource... resource) {
    val factory = new YamlPropertiesFactoryBean();
    factory.setResolutionMethod(YamlProcessor.ResolutionMethod.OVERRIDE);
    factory.setResources(resource);
    factory.setSingleton(true);
    factory.afterPropertiesSet();
    return factory.getObject();
  }
}

相关文章