code: public static GrailsApplication lookupApplication(ServletContext servletContext) {
          WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
          return (GrailsApplication)wac.getBean(GrailsApplication.APPLICATION_ID);
      }
docs: Looks up the GrailsApplication instance
  
  @return The GrailsApplication instance