Holders.setConfig(config);
appCtx.registerMockBean(GrailsApplication.APPLICATION_ID, grailsApplication);
GrailsConventionGroovyPageLocator pageLocator = new GrailsConventionGroovyPageLocator();
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);