|
Search XAP 7.0
Offline Documentation
Download latest offline documentation in HTML format:
|
Summary: Allows you to inject a predefined GigaSpace instance using annotations.
GigaSpace ContextSpring dependency injection support allows you to inject the GigaSpace instace using either setter injection or constructor injection. OpenSpaces extends this injection mechanism by allowing you to use annotations to inject a GigaSpace instance. The following code uses the annotation-based injection: public class MyService { @GigaSpaceContext private GigaSpace gigaSpace; } In the above case, 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: GigaSpace Late ContextOpenSpaces allows you to define beans (such as filters), that are later injected to the actual space. If such beans require access to the GigaSpace instance, a cyclic dependency occurs (GigaSpace requires the Space, but the Space requires the filter injection). OpenSpaces allows you to use the same annotation-based injection mechanism in order to inject the GigaSpace instance at a different lifecycle stage. The following code uses the annotation-based injection: public class MyService { @GigaSpaceLateContext private GigaSpace gigaSpace; } In the above case, 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: Multiple GigaSpace InstancesThere can be more than one GigaSpace instance defined within the same Spring application context. In such cases, the annotation-based injection requires the ID of the GigaSpace instance it should inject. You should use the name property to identify it. The following code uses the annotation-based injection (note the name property usage): public class MyService { @GigaSpaceContext(name="directGigaSpace") private GigaSpace directGigaSpace; @GigaSpaceContext(name=""clusteredGigaSpace") private GigaSpace clusteredGigaSpace; } In the above case, 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: |
The GigaSpaceContext Annotation
IMPORTANT: This is an old version of GigaSpaces XAP. Click here for the latest version.
(None)
