Package org.alfresco.config
Class SystemPropertiesFactoryBean
java.lang.Object
org.springframework.core.io.support.PropertiesLoaderSupport
org.springframework.beans.factory.config.PropertiesFactoryBean
org.alfresco.config.SystemPropertiesFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<Properties>
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
JndiPropertiesFactoryBean
public class SystemPropertiesFactoryBean
extends org.springframework.beans.factory.config.PropertiesFactoryBean
Like the parent
PropertiesFactoryBean
, but overrides or augments the resulting property set with values
from VM system properties. As with the Spring PropertyPlaceholderConfigurer
the following modes are
supported:
- SYSTEM_PROPERTIES_MODE_NEVER: Don't use system properties at all.
- SYSTEM_PROPERTIES_MODE_FALLBACK: Fallback to a system property only for undefined properties.
- SYSTEM_PROPERTIES_MODE_OVERRIDE: (DEFAULT)Use a system property if it is available.
PropertiesLoaderSupport.setProperties(Properties)
or PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource[])
or
their names have been included explicitly in the set passed to setSystemProperties(Set)
.- Author:
- Derek Hulley
-
Field Summary
Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
localOverride, localProperties, logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Properties
protected void
resolveMergedProperty
(String systemProperty, Properties props) Override hook.void
setSystemProperties
(Set<String> systemProperties) Set the names of the properties that can be considered for overriding.void
setSystemPropertiesMode
(int systemPropertiesMode) Set how to check system properties.void
setSystemPropertiesModeName
(String constantName) Set the system property mode by the name of the corresponding constant, e.g.Methods inherited from class org.springframework.beans.factory.config.PropertiesFactoryBean
afterPropertiesSet, createProperties, getObject, getObjectType, isSingleton, setSingleton
Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
loadProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
-
Constructor Details
-
SystemPropertiesFactoryBean
public SystemPropertiesFactoryBean()
-
-
Method Details
-
setSystemPropertiesModeName
Set the system property mode by the name of the corresponding constant, e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE".- Parameters:
constantName
- name of the constant- Throws:
IllegalArgumentException
- if an invalid constant was specified- See Also:
-
setSystemPropertiesMode
public void setSystemPropertiesMode(int systemPropertiesMode) Set how to check system properties.- See Also:
-
PropertyPlaceholderConfigurer.setSystemPropertiesMode(int)
-
setSystemProperties
Set the names of the properties that can be considered for overriding.- Parameters:
systemProperties
- a set of properties that can be fetched from the system properties
-
mergeProperties
- Overrides:
mergeProperties
in classorg.springframework.core.io.support.PropertiesLoaderSupport
- Throws:
IOException
-
resolveMergedProperty
Override hook. Allows subclasses to resolve a merged property from an alternative source, whilst still respecting the chosen system property fallback path.- Parameters:
systemProperty
- Stringprops
- Properties
-