Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.YamlPropertiesFactoryBean


  @Override
  public PropertySource<?> load(String name, Resource resource, String profile)
      throws IOException {
    if (ClassUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) {
      YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
      if (profile == null) {
        factory.setMatchDefault(true);
        factory.setDocumentMatchers(new SpringProfileDocumentMatcher());
      }
      else {
        factory.setMatchDefault(false);
        factory.setDocumentMatchers(new SpringProfileDocumentMatcher(profile));
      }
      factory.setResources(new Resource[] { resource });
      Properties properties = factory.getObject();
      if (!properties.isEmpty()) {
        return new PropertiesPropertySource(name, properties);
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.YamlPropertiesFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.