|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,FIELD})
@Apache20LicenseCompatible
public @interface GridSpringResourceAnnotates a field or a setter method for injection of resource from Spring ApplicationContext. Use it whenever you would like to inject resources specified in Spring application context of XML configuration.
Logger can be injected into instances of following classes:
Note that Spring resources cannot be peer-class-loaded. They must be available in
every ApplcationContext or Spring XML configuration on every grid node.
For this reason, if injected into a Serializable class, they must
be declared as transient.
The lifecycle of Spring resources is controled by Spring container.
public class MyGridJob implements GridJob {
...
@GridSpringResource(resourceName = "bean-name")
private transient MyUserBean rsrc;
...
@GridUserResource
private transient MyUserResource rsrc;
...
}
or
public class MyGridJob implements GridJob {
...
private transient MyUserBean rsrc = null;
...
@GridSpringResource(resourceName = "bean-name")
public void setMyUserBean(MyUserBean rsrc) {
this.rsrc = rsrc;
}
...
}
and user resource MyUserResource
public class MyUserResource {
...
@GridSpringResource(resourceName = "bean-name")
private MyUserBean rsrc;
...
// Inject logger (or any other resource).
@GridLoggerResource
private GridLogger log = null;
// Inject grid instance (or any other resource).
@GridInstanceResource
private Grid grid = null;
...
}
where spring bean resource class can look like this:
public class MyUserBean {
...
}
and Spring file
<bean id="bean-name" class="my.foo.MyUserBean" singleton="true">
...
</bean>
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

| Required Element Summary | |
|---|---|
String |
resourceName
Resource bean name in provided ApplicationContext to look up a Spring bean. |
| Element Detail |
|---|
public abstract String resourceName
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|