Exemplo n.º 1
0
 /** @return The ApplicationContext or null if it doesn't exist */
 public static GrailsApplication findApplication() {
   for (GrailsApplicationDiscoveryStrategy strategy : applicationDiscoveryStrategies) {
     GrailsApplication grailsApplication = strategy.findGrailsApplication();
     if (grailsApplication != null) {
       return grailsApplication;
     }
   }
   return applicationSingleton;
 }
Exemplo n.º 2
0
 /** @return The ApplicationContext or null if it doesn't exist */
 public static ApplicationContext findApplicationContext() {
   for (GrailsApplicationDiscoveryStrategy strategy : applicationDiscoveryStrategies) {
     ApplicationContext applicationContext = strategy.findApplicationContext();
     if (applicationContext != null) {
       return applicationContext;
     }
   }
   return null;
 }
Exemplo n.º 3
0
 public static ApplicationContext getApplicationContext() {
   for (GrailsApplicationDiscoveryStrategy strategy : applicationDiscoveryStrategies) {
     ApplicationContext applicationContext = strategy.findApplicationContext();
     if (applicationContext != null) {
       boolean running = ((Lifecycle) applicationContext).isRunning();
       if (running) {
         return applicationContext;
       }
     }
   }
   throw new IllegalStateException(
       "Could not find ApplicationContext, configure Grails correctly first");
 }