Sometimes you need to access your Spring application context from a Spring instrumentalized Bean. For this use case you need to implement the ApplicationContextAware interface. The following code snippets desribes the usage:
Implementation class:
Rafael Sobek
Implementation class:
public class ApplicationContextProvider implements ApplicationContextAware {
private ApplicationContext applicationContext;
public ApplicationContext getApplicationContext() {
return applicationContext;
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}
Spring configuration:
<bean id="applicationContextProvider" class="org.developers.blog.spring.examples.ApplicationContextProvider"></bean>Regards
Rafael Sobek
Technorati Tags: Spring ApplicationContextAware

Its really helpful and solved my problem, thank you