protected GenericApplicationContext createApplicationContext(ApplicationContext parentCtx) {
if (parentCtx != null && beanFactory != null) {
Assert.isInstanceOf(DefaultListableBeanFactory.class, beanFactory,
"ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
GrailsWebApplicationContext ctx = new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory, grailsApplication);
ctx.setParent(parentCtx);
return ctx;
}
if (beanFactory != null) {
Assert.isInstanceOf(DefaultListableBeanFactory.class, beanFactory,
"ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
return new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory, grailsApplication);
}
if (parentCtx != null) {
GrailsWebApplicationContext ctx = new GrailsWebApplicationContext(grailsApplication);
ctx.setParent(parentCtx);
return ctx;
}
return new GrailsWebApplicationContext();
}