| <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Using Spring, Spring DM, and Blueprint</title><meta content="DocBook XSL Stylesheets V1.76.0" name="generator"><link rel="home" href="index.html" title="Virgo Programmer Guide"><link rel="up" href="ch04.html" title="Chapter 4. Developing Applications"><link rel="prev" href="ch04s04.html" title="Creating and Using Configuration Artifacts"><link rel="next" href="ch04s06.html" title="Programmatic Access to the Servlet Context"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><td align="left" width="20%"><a accesskey="p" href="ch04s04.html">Prev</a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="ch04s06.html">Next</a></td></tr></table><hr></div><div class="section" title="Using Spring, Spring DM, and Blueprint"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-spring"></a>Using Spring, Spring DM, and Blueprint</h2></div></div></div><p> |
| Virgo supports the use of Spring framework and Spring DM (as supported by Gemini Blueprint) by application bundles. |
| </p><p> |
| Spring (and Spring DM) application context XML files should generally be placed in a bundle's <code class="literal">META-INF/spring</code> directory, but |
| for a web application, these files must be placed in the <code class="literal">WEB-INF</code> directory. |
| </p><div class="tip" title="A common mistake" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"> |
| A common mistake |
| </h3><p> |
| Placing a web application's Spring application context XML files in the <code class="literal">META-INF/spring</code> directory produces |
| unpredictable results since Spring DM will attempt to build an application context independently of, and asynchronously from, |
| the web application. |
| </p></div><p> |
| To use Spring DM from a web application, the <code class="literal">contextClass</code> servlet parameter and the servlet context listener |
| should be configured (in <code class="literal">WEB-INF/web.xml</code>) like this: |
| </p><pre class="programlisting"> |
| <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> |
| </pre><p> |
| </p><p> |
| Virgo has Gemini Blueprint built-in and thereby supports the OSGi Blueprint standard in addition to Spring DM. |
| </p><p> |
| For detailed information on Spring Framework, Spring DM, and Blueprint, please see <a class="xref" href="ch01s02.html" title="References">References</a>. |
| </p></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch04s04.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="ch04.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="ch04s06.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%"> </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> </td></tr></table></div></body></html> |