public class ApplicationContextProvider
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
Constructor and Description |
---|
ApplicationContextProvider() |
Modifier and Type | Method and Description |
---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext() |
static java.lang.Object |
getManagedBean(java.lang.Class<?> clazz)
Returns the Spring-managed instance for the specified class.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext ac) |
public static org.springframework.context.ApplicationContext getApplicationContext()
public void setApplicationContext(org.springframework.context.ApplicationContext ac) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public static java.lang.Object getManagedBean(java.lang.Class<?> clazz)
Usage example: SomeManager sm = (SomeManager) ApplicationContextProvider.getManagedBean(SomeManager.class);
That is equivalent to:
SomeManager sm = ApplicationContextProvider.getContext.getBean(SomeManager.class);
clazz
- Interface for which you want the concrete implementation