Package org.springframework.core
Class SpringProperties
java.lang.Object
org.springframework.core.SpringProperties
Static holder for local Spring properties, i.e. defined at the Spring library level.
Reads a spring.properties file from the root of the Spring library classpath,
and also allows for programmatically setting properties through setProperty(java.lang.String, java.lang.String).
When checking a property, local entries are being checked first, then falling back
to JVM-level system properties through a System.getProperty(java.lang.String) 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(java.lang.String) for a convenient way to locally set such flags to "true".
- Since:
- 3.2.7
- Author:
- Juergen Hoeller
- See Also:
-
StandardBeanInfoFactory.IGNORE_BEANINFO_PROPERTY_NAMEAbstractEnvironment.IGNORE_GETENV_PROPERTY_NAMESpelParserConfiguration.SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAMEStatementCreatorUtils.IGNORE_GETPARAMETERTYPE_PROPERTY_NAMEJndiLocatorDelegate.IGNORE_JNDI_PROPERTY_NAMESpringObjenesis.IGNORE_OBJENESIS_PROPERTY_NAMENestedTestConfiguration.ENCLOSING_CONFIGURATION_PROPERTY_NAMETestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAMEContextCache.MAX_CONTEXT_CACHE_SIZE_PROPERTY_NAME
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanRetrieve the flag for the given property key.static StringgetProperty(String key) Retrieve the property value for the given key, checking local Spring properties first and falling back to JVM-level system properties.static voidProgrammatically set a local flag to "true", overriding an entry in thespring.propertiesfile (if any).static voidsetProperty(String key, String value) Programmatically set a local property, overriding an entry in thespring.propertiesfile (if any).
-
Method Details
-
setProperty
Programmatically set a local property, overriding an entry in thespring.propertiesfile (if any).- Parameters:
key- the property keyvalue- the associated property value, ornullto reset it
-
getProperty
Retrieve the property value for the given key, checking local Spring properties first and falling back to JVM-level system properties.- Parameters:
key- the property key- Returns:
- the associated property value, or
nullif none found
-
setFlag
Programmatically set a local flag to "true", overriding an entry in thespring.propertiesfile (if any).- Parameters:
key- the property key
-
getFlag
Retrieve the flag for the given property key.- Parameters:
key- the property key- Returns:
trueif the property is set to "true", false otherwise
-