GroovyPagesTemplateEngine gpte = new GroovyPagesTemplateEngine();
gpte.setServletContext(appCtx.getServletContext());
gpte.setApplicationContext(appCtx);
gpte.afterPropertiesSet();
GroovyPageViewResolver grailsViewResolver=new GroovyPageViewResolver();
grailsViewResolver.setApplicationContext(appCtx);
grailsViewResolver.setGroovyPageLocator(pageLocator);
grailsViewResolver.setTemplateEngine(gpte);
GroovyPageLayoutFinder layoutFinder = new GroovyPageLayoutFinder();
layoutFinder.setViewResolver(grailsViewResolver);
@SuppressWarnings("rawtypes")
Map flat = config != null ? config.flatten() : Collections.emptyMap();