Reads a spring.properties file from the root of the Spring library classpath,
and also allows for programmatically setting properties through setProperty.
When checking a property, local entries are being checked first, then falling back
to JVM-level system properties through a System#getProperty check.
This is an alternative way to set Spring-related system properties such as
"spring.getenv.ignore" and "spring.beaninfo.ignore", in particular for scenarios
where JVM system properties are locked on the target platform (e.g. WebSphere).
See setFlag for a convenient way to locally set such flags to "true".
org.springframework.beans.StandardBeanInfoFactory#IGNORE_BEANINFO_PROPERTY_NAME , org.springframework.core.env.AbstractEnvironment#IGNORE_GETENV_PROPERTY_NAME , org.springframework.expression.spel.SpelParserConfiguration#SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME , org.springframework.jdbc.core.StatementCreatorUtils#IGNORE_GETPARAMETERTYPE_PROPERTY_NAME , org.springframework.jndi.JndiLocatorDelegate#IGNORE_JNDI_PROPERTY_NAME , org.springframework.objenesis.SpringObjenesis#IGNORE_OBJENESIS_PROPERTY_NAME , org.springframework.test.context.NestedTestConfiguration#ENCLOSING_CONFIGURATION_PROPERTY_NAME , org.springframework.test.context.TestConstructor#TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAME , org.springframework.test.context.cache.ContextCache#MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME
| Modifier and Type | Field and Description |
|---|---|
| private static final Properties | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public static String | Returns: the associated property value, ornull if none foundthe property key key)Retrieve the property value for the given key, checking local Spring properties first and falling back to JVM-level system properties. |
| public static void | |
| public static void | setProperty(String
the property key key, String the associated property value, or value)null to reset itProgrammatically set a local property, overriding an entry in the
|
| localProperties | back to summary |
|---|---|
| private static final Properties localProperties | |
| PROPERTIES_RESOURCE_LOCATION | back to summary |
|---|---|
| private static final String PROPERTIES_RESOURCE_LOCATION | |
| SpringProperties | back to summary |
|---|---|
| private SpringProperties() | |
| getFlag | back to summary |
|---|---|
| public static boolean getFlag(String key) Retrieve the flag for the given property key.
| |
| getProperty | back to summary |
|---|---|
| public static String getProperty(String key) Retrieve the property value for the given key, checking local Spring properties first and falling back to JVM-level system properties. | |
| setFlag | back to summary |
|---|---|
| public static void setFlag(String key) Programmatically set a local flag to "true", overriding an
entry in the
| |
| setProperty | back to summary |
|---|---|
| public static void setProperty(String key, String value) Programmatically set a local property, overriding an entry in the
| |