It should look like this:
The holder bean
Code:
public class AppCtxHolder implements ApplicationContextAware {
private static ApplicationContext ctx;
public AppCtxHolder() {}
public void setApplicationContext(ApplicationContext applicationContext) {
ctx = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return ctx;
}
}
The definition
Code:
<beans>
<bean id="appCtxHolder" class="xyz.AppCtxHolder"/>
</beans>
Usage:
Code:
...
ApplicationContext ctx = AppCtxHolder.getApplicationContext();
// use ctx
...
Hope that makes things clearer,
Andreas