public class ReloadablePropertySource
extends org.springframework.core.env.MapPropertySource
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.configuration.Configuration |
configuration |
protected org.apache.commons.configuration.event.ConfigurationErrorEvent |
lastConfigurationErrorEvent |
protected long |
lastRefreshTime |
static String |
REFRESH_INTERVAL_SECS_OVERRIDE_KEY
The override key for the refresh interval seconds.
|
protected long |
refreshIntervalMillis |
| Constructor and Description |
|---|
ReloadablePropertySource(String name,
Properties source,
org.apache.commons.configuration.Configuration configuration)
Constructs the object with a default refresh interval of 60 seconds.
|
ReloadablePropertySource(String name,
Properties source,
org.apache.commons.configuration.Configuration configuration,
long refreshIntervalSecs)
Constructs the object with all parameters specified.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getProperty(String name)
Gets a property by name while possibly refreshing the properties if needed.
|
protected void |
refreshPropertiesIfNeeded()
Refreshes the properties from the configuration if it's time to.
|
containsProperty, getPropertyNamesprotected org.apache.commons.configuration.Configuration configuration
protected long lastRefreshTime
protected long refreshIntervalMillis
protected org.apache.commons.configuration.event.ConfigurationErrorEvent lastConfigurationErrorEvent
public static final String REFRESH_INTERVAL_SECS_OVERRIDE_KEY
public ReloadablePropertySource(String name, Properties source, org.apache.commons.configuration.Configuration configuration)
name - the name of the property source.source - the properties.configuration - the configuration that knows how to read properties.public ReloadablePropertySource(String name, Properties source, org.apache.commons.configuration.Configuration configuration, long refreshIntervalSecs)
name - the name of the property source.source - the properties.configuration - the configuration that knows how to read properties.refreshIntervalSecs - the refresh interval in seconds to wait before refreshing the properties when a property is requested.public Object getProperty(String name)
getProperty in class org.springframework.core.env.MapPropertySourcename - the property name.protected void refreshPropertiesIfNeeded()
Copyright © 2019. All rights reserved.