public class PropertySourceUtils extends Object
| Constructor and Description |
|---|
PropertySourceUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<org.springframework.core.env.EnumerablePropertySource<?>> |
asEnumerableList(List<org.springframework.core.env.PropertySource<?>> sources)
Create an
EnumerablePropertySource list from a PropertySource list |
static List<org.springframework.core.env.EnumerablePropertySource<?>> |
asEnumerableListQuietly(List<org.springframework.core.env.PropertySource<?>> sources)
Create an
EnumerablePropertySource list from a PropertySource list |
static List<org.springframework.core.env.PropertySource<?>> |
asList(org.springframework.core.env.PropertySource<?>... sources)
Null safe conversion of
PropertySource>[] into List<PropertySource<?>> |
static Properties |
convert(org.springframework.core.env.EnumerablePropertySource<?> source)
Copy the key/value pairs from
source into a java.util.Properties object. |
static Properties |
convert(List<org.springframework.core.env.EnumerablePropertySource<?>> sources)
Copy the key/value pairs from
sources into a java.util.Properties object. |
static List<org.springframework.core.env.PropertySource<?>> |
extractPropertySourcesAndClose(org.springframework.context.ConfigurableApplicationContext context) |
static Properties |
getAllEnumerableProperties(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate every property from every
PropertySource in the ConfigurableEnvironment into a Properties object. |
static Properties |
getAllEnumerablePropertiesQuietly(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate every property from every
PropertySource in the ConfigurableEnvironment into a Properties object. |
static org.springframework.core.env.PropertySource<?> |
getDefaultPropertySource()
Return a property source from system properties plus the environment
|
static ImmutableProperties |
getEnvAsImmutableProperties(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate every property from every
PropertySource in the ConfigurableEnvironment into an Properties object. |
static org.springframework.core.env.PropertySource<?> |
getPropertySource(Properties properties)
Return a property source based on the properties object passed in, but where system properties plus environment properties "win"
|
static org.springframework.core.env.PropertySource<?> |
getPropertySource(PropertiesService service,
List<Location> locations)
Return a property source based on the properties loaded from the locations passed in.
|
static org.springframework.core.env.PropertySource<?> |
getPropertySource(PropertiesService service,
List<Location> locations,
boolean includeGlobal)
Return a property source based on the properties loaded from the locations passed in, but where system properties plus environment properties "win" if
includeGlobal=true |
static List<org.springframework.core.env.PropertySource<?>> |
getPropertySources(Class<?> annotatedClass) |
static List<org.springframework.core.env.PropertySource<?>> |
getPropertySources(org.springframework.context.ConfigurableApplicationContext context)
Return all
PropertySource beans registered in the context, sorted by name. |
static List<org.springframework.core.env.PropertySource<?>> |
getPropertySources(org.springframework.context.ConfigurableApplicationContext context,
Comparator<org.springframework.core.env.PropertySource<?>> comparator)
Return all
PropertySource beans registered in the context, sorted use comparator |
static List<org.springframework.core.env.PropertySource<?>> |
getPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
Aggregate all
PropertySource> |
static SpringContext |
getSinglePropertySourceContext(org.springframework.core.env.PropertySource<?> source)
Return a
SpringContext such that source is the only thing Spring uses to resolve placeholders |
static void |
reconfigurePropertySources(org.springframework.core.env.ConfigurableEnvironment env,
String name,
Properties properties)
Remove all property sources from
env and replace them with a single PropertiesPropertySource backed by properties |
static void |
removeAllPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
Remove all property sources from
env. |
public PropertySourceUtils()
public static org.springframework.core.env.PropertySource<?> getDefaultPropertySource()
public static org.springframework.core.env.PropertySource<?> getPropertySource(Properties properties)
public static org.springframework.core.env.PropertySource<?> getPropertySource(PropertiesService service, List<Location> locations)
public static org.springframework.core.env.PropertySource<?> getPropertySource(PropertiesService service, List<Location> locations, boolean includeGlobal)
includeGlobal=truepublic static Properties getAllEnumerableProperties(org.springframework.core.env.ConfigurableEnvironment env)
PropertySource in the ConfigurableEnvironment into a Properties object.IllegalArgumentException - If any PropertySource is not an EnumerablePropertySource or if any values are not java.lang.Stringpublic static Properties getAllEnumerablePropertiesQuietly(org.springframework.core.env.ConfigurableEnvironment env)
PropertySource in the ConfigurableEnvironment into a Properties object.
If a PropertySource is not Enumerable, just omit it from the list, but do not throw an exceptionpublic static ImmutableProperties getEnvAsImmutableProperties(org.springframework.core.env.ConfigurableEnvironment env)
PropertySource in the ConfigurableEnvironment into an Properties object.IllegalArgumentException - If any PropertySource is not an EnumerablePropertySource or if any values are not java.lang.Stringpublic static List<org.springframework.core.env.EnumerablePropertySource<?>> asEnumerableList(List<org.springframework.core.env.PropertySource<?>> sources)
EnumerablePropertySource list from a PropertySource listIllegalArgumentException - if any element in sources is not an EnumerablePropertySourcepublic static List<org.springframework.core.env.EnumerablePropertySource<?>> asEnumerableListQuietly(List<org.springframework.core.env.PropertySource<?>> sources)
EnumerablePropertySource list from a PropertySource listIllegalArgumentException - if any element in sources is not an EnumerablePropertySourcepublic static List<org.springframework.core.env.PropertySource<?>> getPropertySources(Class<?> annotatedClass)
public static List<org.springframework.core.env.PropertySource<?>> extractPropertySourcesAndClose(org.springframework.context.ConfigurableApplicationContext context)
public static Properties convert(org.springframework.core.env.EnumerablePropertySource<?> source)
source into a java.util.Properties object.IllegalArgumentException - if any value is null or is not a java.lang.Stringpublic static Properties convert(List<org.springframework.core.env.EnumerablePropertySource<?>> sources)
sources into a java.util.Properties object.IllegalArgumentException - if any value is null or is not a java.lang.Stringpublic static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
PropertySource> objects from the environment into a Listpublic static void reconfigurePropertySources(org.springframework.core.env.ConfigurableEnvironment env, String name, Properties properties)
env and replace them with a single PropertiesPropertySource backed by propertiespublic static void removeAllPropertySources(org.springframework.core.env.ConfigurableEnvironment env)
env.public static List<org.springframework.core.env.PropertySource<?>> asList(org.springframework.core.env.PropertySource<?>... sources)
PropertySource>[] into List<PropertySource<?>>public static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context, Comparator<org.springframework.core.env.PropertySource<?>> comparator)
PropertySource beans registered in the context, sorted use comparatorpublic static List<org.springframework.core.env.PropertySource<?>> getPropertySources(org.springframework.context.ConfigurableApplicationContext context)
PropertySource beans registered in the context, sorted by name.public static SpringContext getSinglePropertySourceContext(org.springframework.core.env.PropertySource<?> source)
SpringContext such that source is the only thing Spring uses to resolve placeholdersCopyright © 2010–2014 The Kuali Foundation. All rights reserved.