public class CurrentApplicationContext extends Object implements org.springframework.context.ApplicationContextAware
@Bean
public CurrentApplicationContext currentAppContext() {
return new CurrentApplicationContext();
}
Once registered, static methods can obtain bean references:
static {
SomeService myService = CurrentApplicationComntext.getContext().getBean(...);
}
public static void foo() {
SomeBean bean = CurrentApplicationComntext.getContext().getBean(...);
}
| Constructor and Description |
|---|
CurrentApplicationContext() |
| Modifier and Type | Method and Description |
|---|---|
static org.springframework.context.ApplicationContext |
getContext()
Note that this is a static method which expose ApplicationContext
|
void |
setApplicationContext(org.springframework.context.ApplicationContext context) |
public void setApplicationContext(org.springframework.context.ApplicationContext context)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic static org.springframework.context.ApplicationContext getContext()
ApplicationContextCopyright © 2018 Global Crop Diversity Trust. All rights reserved.