org.apache.ignite

## Class IgniteSpring

- java.lang.Object
- - org.apache.ignite.IgniteSpring

-     public class IgniteSpring
      extends Object

  Factory methods to start Ignite with optional Spring application context, this context can be injected into grid tasks and grid jobs using `@SpringApplicationContextResource` annotation.

  You can also instantiate grid directly from Spring without using `Ignite`. For more information refer to `IgniteSpringBean` documentation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteSpring()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Ignite` | `start(@Nullable org.springframework.context.ApplicationContext springCtx)` Starts grid with default configuration.
    `static Ignite` | `start(IgniteConfiguration cfg, @Nullable org.springframework.context.ApplicationContext springCtx)` Starts grid with given configuration.
    `static Ignite` | `start(String springCfgPath, @Nullable org.springframework.context.ApplicationContext springCtx)` Starts all grids specified within given Spring XML configuration file.
    `static Ignite` | `start(URL springCfgUrl, @Nullable org.springframework.context.ApplicationContext springCtx)` Starts all grids specified within given Spring XML configuration file URL.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IgniteSpring

          public IgniteSpring()

  - ### Method Detail

    - #### start

          public static Ignite start(@Nullable
                                     @Nullable org.springframework.context.ApplicationContext springCtx)
                              throws IgniteCheckedException

      Starts grid with default configuration. By default this method will use grid configuration defined in `IGNITE_HOME/config/default-config.xml` configuration file. If such file is not found, then all system defaults will be used.
      Parameters:
        `springCtx` - Optional Spring application context, possibly `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 `@SpringApplicationContextResource` annotation.
      Returns:
        Started grid.
      Throws:
        `IgniteCheckedException` - If default grid could not be started. This exception will be thrown also if default grid has already been started.

    - #### start

          public static Ignite start(IgniteConfiguration cfg,
                                     @Nullable
                                     @Nullable org.springframework.context.ApplicationContext springCtx)
                              throws IgniteCheckedException

      Starts grid with given configuration.
      Parameters:
        `cfg` - Grid configuration. This cannot be `null`.
        `springCtx` - Optional Spring application context, possibly `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 `@SpringApplicationContextResource` annotation.
      Returns:
        Started grid.
      Throws:
        `IgniteCheckedException` - If grid could not be started. This exception will be thrown also if named grid has already been started.

    - #### start

          public static Ignite start(String springCfgPath,
                                     @Nullable
                                     @Nullable org.springframework.context.ApplicationContext springCtx)
                              throws IgniteCheckedException

      Starts all grids specified within given Spring XML configuration file. If grid with given name is already started, then exception is thrown. In this case all instances that may have been started so far will be stopped too.

      Usually Spring XML configuration file will contain only one Grid definition. Note that Grid configuration bean(s) is retrieved form configuration file by type, so the name of the Grid configuration bean is ignored.

      Parameters:
        `springCfgPath` - Spring XML configuration file path or URL. This cannot be `null`.
        `springCtx` - Optional Spring application context, possibly `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 `@SpringApplicationContextResource` annotation.
      Returns:
        Started grid. If Spring configuration contains multiple grid instances, then the 1st found instance is returned.
      Throws:
        `IgniteCheckedException` - If grid could not be started or configuration read. This exception will be thrown also if grid with given name has already been started or Spring XML configuration file is invalid.

    - #### start

          public static Ignite start(URL springCfgUrl,
                                     @Nullable
                                     @Nullable org.springframework.context.ApplicationContext springCtx)
                              throws IgniteCheckedException

      Starts all grids specified within given Spring XML configuration file URL. If grid with given name is already started, then exception is thrown. In this case all instances that may have been started so far will be stopped too.

      Usually Spring XML configuration file will contain only one Grid definition. Note that Grid configuration bean(s) is retrieved form configuration file by type, so the name of the Grid configuration bean is ignored.

      Parameters:
        `springCfgUrl` - Spring XML configuration file URL. This cannot be `null`.
        `springCtx` - Optional Spring application context, possibly `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 `@GridSpringApplicationContextResource` annotation.
      Returns:
        Started grid. If Spring configuration contains multiple grid instances, then the 1st found instance is returned.
      Throws:
        `IgniteCheckedException` - If grid could not be started or configuration read. This exception will be thrown also if grid with given name has already been started or Spring XML configuration file is invalid.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023