I want to inject an ApplicationContext
itself to a bean.
Something like
public void setApplicationContext(ApplicationContect context) {
this.context = context;
}
Is that possible in spring?
I want to inject an ApplicationContext
itself to a bean.
Something like
public void setApplicationContext(ApplicationContect context) {
this.context = context;
}
Is that possible in spring?
Easy, using the
ApplicationContextAware
interface.Then in your actual applicationContext you only need to reference your bean.
Yes, just implement the ApplicationContextAware -interface.
Previous comments are ok, but I usually prefer: