pageLocator.setApplicationContext(appCtx);
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);