Package com.appjars.utils
Class SpringContextUtils
java.lang.Object
com.appjars.utils.SpringContextUtils
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Component
public class SpringContextUtils
extends Object
implements org.springframework.context.ApplicationContextAware
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.springframework.context.ApplicationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.context.ApplicationContextstatic StringgetProperty(String key) Returns a property value from the Spring environment.static StringgetProperty(String key, String defaultValue) Returns a property value from the Spring environment.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Field Details
-
context
protected static org.springframework.context.ApplicationContext context
-
-
Constructor Details
-
SpringContextUtils
public SpringContextUtils()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext() -
getProperty
Returns a property value from the Spring environment.- Parameters:
key- the property keydefaultValue- the default value if the property is not found- Returns:
- the property value or the default value
-
getProperty
Returns a property value from the Spring environment.- Parameters:
key- the property key- Returns:
- the property value or null if not found
-