Program guide > Programming for Spring integration
Spring managed extension beans
You can declare plain old Java objects (POJOs) to use as extension points in the objectgrid.xml file. If you name the beans and then specify the class name, eXtreme Scale normally creates instances of the specified class and uses those instances as the plug-in. WebSphere eXtreme Scale can now delegate to Spring to act as the bean factory for obtaining instances of these plug-in objects.
If an application uses Spring, POJOs have a requirement to be accessible to the rest of the application.
An application can register a Spring Bean Factory instance to use for an ObjectGrid specified by name. The application creates an instance of BeanFactory or a Spring application context and then registers it with ObjectGrid using the following static method:
void registerSpringBeanFactoryAdapter(String objectGridName, Object springBeanFactory)
The previous method applies to the case when eXtreme Scale finds an extension bean whose className begins with the prefix {spring}. Such an extension bean, which could be an ObjectTransformer, Loader, TransactionCallback, and so on, uses the remainder of the name as a Spring Bean name. Then it obtains the bean instance using the Spring Bean Factory.
The eXtreme Scale deployment environment can also create a Spring bean factory from a default Spring XML configuration file. If no bean factory was registered for a given ObjectGrid, then your deployment searches for an XML file called "/<ObjectGridName>_spring.xml" automatically. For example, if the data grid is called GRID, then the XML file is called "/GRID_spring.xml' and appears in the class path in the root package. ObjectGrid constructs an ApplicationContext using the "/<ObjectGridName>_spring.xml file and constructs beans from that bean factory.
The following is an example class name:
"{spring}MyLoaderBean"Using the previous class name allows eXtreme Scale to use Spring to search for a bean named "MyLoaderBean". You can specify Spring-managed POJOs for any extension point if the bean factory has been registered. The Spring extensions are in the ogspring.jar file. This JAR file must be on the class path for Spring support. If a J2EE application runs in WebSphere Application Server Network Deployment augmented with WebSphere Extended Deployment, then place the applicaitonhe application should place the spring.jar file and its associated files in the EAR modules. The ogspring.jar must also be placed in the same location.
Parent topic:
Program for Spring integration
Related concepts
Spring extension beans and namespace support
Related tasks
Manage transactions with Spring
Start a container server with Spring