Apache Ignite Documentation

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.


GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.


Let's jump right in!


Documentation     Ask a Question     Download


Javadoc     Scaladoc     Examples

Resource Injection


Ignite allows dependency injection of pre-defined Ignite resources, and supports field-based as well as method-based injection. Resources with proper annotations will be injected into the corresponding task, job, closure, or SPI before it is initialized.

Field Based and Method Based

You can inject resources by annotating either a field or a method. When you annotate a field, Ignite simply sets the value of the field at injection time (disregarding an access modifier of the field). If you annotate a method with resource annotation, it should accept an input parameter of the type corresponding to an injected resource. If it does, then the method is invoked at injection time with the appropriate resource passed as an input argument.

Ignite ignite = Ignition.ignite();

Collection<String> res = ignite.compute().broadcast(new IgniteCallable<String>() {
  // Inject Ignite instance.  
  private Ignite ignite;

  public String call() throws Exception { 
    IgniteCache<Object, Object> cache = ignite.getOrCreateCache(CACHE_NAME);

    // Do some stuff with cache.
public class MyClusterJob implements ComputeJob {
    private Ignite ignite;
    // Inject Ignite instance.  
    public void setIgnite(Ignite ignite) {
        this.ignite = ignite;

Pre-defined Resources

There are a number of pre-defined Ignite resources that you can inject:




Injects grid cache name provided via CacheConfiguration.getName().


Injects current CacheStoreSession instance.


Injects current instance of Ignite API.


Injects instance of ComputeJobContext. Job context holds useful information about a particular job execution. For example, you can get the name of the cache containing the entry for which a job was Collocated.


Injects an instance of ComputeLoadBalancer that can be used by a task to do the load balancing.


Injects Ignite service by specified service name.


Injects Spring's ApplicationContext resource.


Injects resource from Spring's ApplicationContext. Use it whenever you would like to access a bean specified in Spring's application context XML configuration.


Injects an instance of ComputeTaskContinuousMapper. Continuous mapping allows to emit jobs from the task at any point, even after initial map phase.


Injects instance of ComputeTaskSession resource which defines a distributed session for a particular task execution.

Updated about a year ago

Resource Injection

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.