Example usage for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setPropertiesPersister

List of usage examples for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setPropertiesPersister

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config PropertyPlaceholderConfigurer setPropertiesPersister.

Prototype

public void setPropertiesPersister(@Nullable PropertiesPersister propertiesPersister) 

Source Link

Document

Set the PropertiesPersister to use for parsing properties files.

Usage

From source file:org.alfresco.cacheserver.dropwizard.Application.java

/**
 * Creates a Spring property place holder configurer for use in a Spring context
 * from the given file path.//  w w  w  . j  a v  a2s .  co m
 * 
 * @param springPropsFileName
 * @return the Spring property place holder configurer
 * @throws IOException 
 */
protected PropertyPlaceholderConfigurer loadSpringConfigurer(String yamlConfigFileLocation) throws IOException {
    if (StringUtils.isEmpty(yamlConfigFileLocation)) {
        throw new IllegalArgumentException("Config file location must not be empty");
    }
    logger.debug("Loading properties from '" + yamlConfigFileLocation + "'");
    PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
    configurer.setLocation(new FileSystemResource(yamlConfigFileLocation));
    configurer.setPropertiesPersister(new YamlPropertiesPersister());
    return configurer;
}