WebSphere eXtreme Scale Programming Guide >
Integrate with Spring framework
Spring is a popular framework for developing Java™ applications. WebSphere eXtreme Scale provides support to allow Spring to manage eXtreme Scale transactions and configure the clients and servers comprising your deployed in-memory data grid.
Spring managed native transactions
Spring provides container-managed transactions that are similar to a Java Platform, Enterprise Edition application server. However, the Spring mechanism can plug in different implementations. WebSphere eXtreme Scale provides transaction manager integration which allows Spring to manage the ObjectGrid transaction life cycles. See Native transactions for details.
Spring managed extension beans and namespace support
Also, eXtreme Scale integrates with Spring to allow Spring-style beans defined for extension points or plug-ins. This feature provides more sophisticated configurations and more flexibility for configuring the extension points.
In addition to Spring managed extension beans, eXtreme Scale provides a Spring namespace called "objectgrid". Beans and built-in implementations are pre-defined in this namespace, which makes it easier for users to configure eXtreme Scale. Refer to Spring extension beans and namespace support for more details on these topics and a sample of how to start an eXtreme Scale container server using Spring configurations.
Shard scope support
With the traditional style Spring configuration, an ObjectGrid bean can either be a singleton type or prototype type. ObjectGrid also supports a new scope called the "shard" scope. If a bean is defined as shard scope, then only one bean is created per shard. All requests for beans with an ID or ids matching that bean definition in the same shard will result in that one specific bean instance being returned by the Spring container.
The following example shows that a com.ibm.ws.objectgrid.jpa.plugins.JPAPropFactoryImpl bean is defined with scope set to shard. Therefore, only one instance of the JPAPropFactoryImpl class is created per shard.
<bean id="jpaPropFactory" class="com.ibm.ws.objectgrid.jpa.plugins.JPAPropFactoryImpl" scope="shard" />
Spring Web Flow
Spring Web Flow stores its session state in the HTTP Session by default. If a web application is configured to use eXtreme Scale for session management then it is used automatically by Spring to store this state and it is made fault tolerant in the same manner as the session.
Package
The eXtreme Scale Spring extensions are in the ogspring.jar file. This Java archive (JAR) file must be on the class path for Spring support to work. If a JEE application that is running in a WebSphere Extended Deployment augmented WebSphere Application Server Network Deployment, then the application should place the spring.jar file and its associated files in the enterprise archive (EAR) modules. You must also place the ogspring.jar file in the same location.
- Native transactions
Spring is a popular framework for developing Java applications. WebSphere eXtreme Scale provides support to allow Spring to manage eXtreme Scale transactions and configure eXtreme Scale clients and servers.- Spring extension beans and namespace support
WebSphere eXtreme Scale provides a feature to declare plain old Java objects (POJOs) to use as extension points in the objectgrid.xml file and a way to name the beans and then specify the class name. Normally, instances of the specified class are created, and those objects are used as the plug-ins. Now, eXtreme Scale can delegate to Spring to obtain instances of these plug-in objects. If an application uses Spring then typically such POJOs have a requirement to be wired in to the rest of the application.