The gridgain.xml is a simple Spring application context. An example configuration is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans"
<description>Gridgain configuration file in gar-file.</description>
In this file, we provide a list with id “ tasks .” This file is consulted to help load any tasks contained in
the GAR file. If you don't specify anything, GridGain will simply search for tasks itself.
Getting Access To The Spring Container From a Task
Instances of the ApplicationContext can be injected into the various GridGain class instances ( GridTask ,
GridJob ,and so forth) using GridGain's @GridSpringApplicationContextResource annotation. This example
shows the Spring application context being injected using the @GridSpringApplicationContextResource
annotation. This works like @Autowired or @Resource :
private ApplicationContext applicationContext ;
Additionally, you can get components injected directly, using the @GridSpringResource :
@GridSpringResource(resourceName = "customerServiceBean")
private transient CustomerService customerService ;
Note the use of transient . These resources aren't copied across the wire, but rather, re-injected on
each node's initialization. This is a crucial tool in your tool belt, especially with volatile resources that
aren't amenable to being sent over the wire, such as DataSource s.
Node-Specific GridGain Configuration
When you start GridGain via the gridgain.sh script, it provides very good defaults. However, sometimes
you will want to exercise more control over the process.
When gridgain.sh is run, it consults (of all things!) a Spring application context for its configuration
information. This file, located at $GRIDGAIN_HOME/config/default-spring.xml , contains all the information
for GridGain to do what it does — communicate with other nodes, clusters, and so forth. Usually, this