Skip to content

Instantly share code, notes, and snippets.

@mente
Created September 16, 2011 13:58
Show Gist options
  • Save mente/1222182 to your computer and use it in GitHub Desktop.
Save mente/1222182 to your computer and use it in GitHub Desktop.
/*
Incorrect initialization
*/
public class MyContextLoaderListener extends ContextLoaderListener {
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
applicationContext.setParent(MySingleton.getContext());
}
}
/*
Correct initialization of spring
*/
public class MyContextLoaderListener extends ContextLoaderListener {
@Override
protected ApplicationContext loadParentContext(ServletContext servletContext) {
return MySingleton.getContext();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment