In previous Spring releases, Spring only allowed you to inject the GigaSpace instance using setter injection or constructor injection. GigaSpaces extended this injection mechanism by allowing you to use annotations to inject a GigaSpace instance. As of Spring 2.5, this is no longer required since Spring support annotation based injection using the @Resource or @Autowired annotations.
Annotation
//There can be more than one GigaSpace instance definedpublicclassMyService{@GigaSpaceContext(name="directGigaSpace")privateGigaSpace directGigaSpace;@GigaSpaceContext(name="clusteredGigaSpace")privateGigaSpace clusteredGigaSpace;}
There is no need to have a setter for the GigaSpace instance, and by annotating it with GigaSpaceContext, a GigaSpace instance is automatically injected. In order to enable this feature, the following element needs to be configured in the Spring application context:
There is no need to have a setter for the GigaSpace instance, and by annotating it with GigaSpaceLateContext, a GigaSpace instance is automatically injected. In order to enable this feature, the following element needs to be configured in the Spring application context: