blob: 2dd9b10e1e8f99da874fcd28d9b0a3c8fe613b96 [file] [log] [blame]
<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&nbsp;4.&nbsp;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>&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;<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">
&lt;context-param&gt;
&lt;param-name&gt;contextClass&lt;/param-name&gt;
&lt;param-value&gt;org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;listener&gt;
&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
&lt;/listener&gt;
</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>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="ch04.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="ch04s06.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;</td></tr></table></div></body></html>