Environment.setInitializing(false);
pluginManager.setApplicationContext(mainContext);
pluginManager.doDynamicMethods();
mainContext.publishEvent(new GrailsContextEvent(mainContext, GrailsContextEvent.DYNAMIC_METHODS_REGISTERED));
performPostProcessing(mainContext);
application.refreshConstraints();
}