/** * Starts grid with given configuration. Note that this method is no-op if grid with the name * provided in given configuration is already started. * * @param cfg Grid configuration. This cannot be {@code null}. * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link GridSpringApplicationContextResource @GridSpringApplicationContextResource} annotation. * @return Started grid. * @throws GridException If grid could not be started. This exception will be thrown * also if named grid has already been started. */ public static Grid start(GridConfiguration cfg, @Nullable GridSpringResourceContext springCtx) throws GridException { A.notNull(cfg, "cfg"); return start0(new GridStartContext(cfg, null, springCtx)).grid(); }
/** * Starts grid with default configuration. By default this method will * use grid configuration defined in {@code GRIDGAIN_HOME/config/default-config.xml} * configuration file. If such file is not found, then all system defaults will be used. * * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using * {@link GridSpringApplicationContextResource @GridSpringApplicationContextResource} annotation. * @return Started grid. * @throws GridException If default grid could not be started. This exception will be thrown * also if default grid has already been started. */ public static Grid start(@Nullable GridSpringResourceContext springCtx) throws GridException { URL url = U.resolveGridGainUrl(DFLT_CFG); if (url != null) return start(DFLT_CFG, null, springCtx); U.warn(null, "Default Spring XML file not found (is GRIDGAIN_HOME set?): " + DFLT_CFG); return start0(new GridStartContext(new GridConfiguration(), null, springCtx)).grid(); }
GridNamedInstance grid = start0( new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx));