com.crygier.spring.util
Class SystemPropertyPlaceholderConfigurer

java.lang.Object
  extended by org.springframework.core.io.support.PropertiesLoaderSupport
      extended by org.springframework.beans.factory.config.PropertyResourceConfigurer
          extended by org.springframework.beans.factory.config.PlaceholderConfigurerSupport
              extended by org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
                  extended by com.crygier.spring.util.SystemPropertyPlaceholderConfigurer
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

public class SystemPropertyPlaceholderConfigurer
extends org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

Property Placeholder Configurer that allows for reading a file that is indicated via a system property. This allows for properties to be loaded from a file that is designated at runtime, and doesn't need to be on the classpath. To Use, Enter Spring Bean as follows:

   
                
                  
                  
                          
                                classpath:application.properties
                          
                  
          
 
Then start your application as follows: java -Dapplication.properties.location=/root/test.properties -jar application.jar This will load properties from application.properties first (from the classpath), then override with /root/test.properties.


Field Summary
 
Fields inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE
 
Fields inherited from class org.springframework.beans.factory.config.PlaceholderConfigurerSupport
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, valueSeparator
 
Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
localOverride, localProperties, logger, XML_FILE_EXTENSION
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
SystemPropertyPlaceholderConfigurer()
           
 
Method Summary
 java.lang.String getSystemProperty()
           
protected  void loadProperties(java.util.Properties props)
           
 void setLocations(org.springframework.core.io.Resource[] locations)
           
 void setSystemProperty(java.lang.String systemProperty)
           
 
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
parseStringValue, processProperties, resolvePlaceholder, resolvePlaceholder, resolveSystemProperty, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName
 
Methods inherited from class org.springframework.beans.factory.config.PlaceholderConfigurerSupport
doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setValueSeparator
 
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertProperty, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder
 
Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setProperties, setPropertiesArray, setPropertiesPersister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemPropertyPlaceholderConfigurer

public SystemPropertyPlaceholderConfigurer()
Method Detail

getSystemProperty

public java.lang.String getSystemProperty()

setSystemProperty

public void setSystemProperty(java.lang.String systemProperty)

setLocations

public void setLocations(org.springframework.core.io.Resource[] locations)
Overrides:
setLocations in class org.springframework.core.io.support.PropertiesLoaderSupport

loadProperties

protected void loadProperties(java.util.Properties props)
                       throws java.io.IOException
Overrides:
loadProperties in class org.springframework.core.io.support.PropertiesLoaderSupport
Throws:
java.io.IOException