Monday, March 30, 2009

Spring ApplicationContextAware

If you need to get Spring Application Context don't initialize it. This operation could be slow. The better way is to allow Spring to inject its context:

public class MyClass implements ApplicationContextAware{
private ApplicationContext context;

public void setApplicationContext(ApplicationContext applicationcontext) throws BeansException {
this.context= applicationcontext;


1 comment: