4.5 Using Spring, Spring DM, and Blueprint
Prev | 4. Developing Applications | Next

## 4.5 Using Spring, Spring DM, and Blueprint

Virgo supports the use of Spring framework and Spring DM (as supported by Gemini Blueprint) by application bundles.

Spring (and Spring DM) application context XML files should generally be placed in a bundle's `META-INF/spring` directory, but for a web application, these files must be placed in the `WEB-INF` directory.

| A common mistake
Placing a web application's Spring application context XML files in the `META-INF/spring` directory produces unpredictable results since Spring DM will attempt to build an application context independently of, and asynchronously from, the web application.

To use Spring DM from a web application, the `contextClass` servlet parameter and the servlet context listener should be configured (in `WEB-INF/web.xml`) like this:

    	<context-param>
    		<param-name>contextClass</param-name>
    		<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
    	</context-param>

    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>

Virgo has Gemini Blueprint built-in and thereby supports the OSGi Blueprint standard in addition to Spring DM.

For detailed information on Spring Framework, Spring DM, and Blueprint, please see Section 1.2, “References”.

Prev | Up | Next
4.4 Creating and Using Configuration Artifacts | Home | 4.6 Programmatic Access to the Servlet Context