| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>4.5 Using Spring, Spring DM, and Blueprint</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo Programmer Guide"><link rel="up" href="ch04.html" title="4. Developing Applications"><link rel="prev" href="ch04s04.html" title="4.4 Creating and Using Configuration Artifacts"><link rel="next" href="ch04s06.html" title="4.6 Programmatic Access to the Servlet Context"><!--Begin Google Analytics code--><script type="text/javascript"> |
| var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); |
| document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| </script><script type="text/javascript"> |
| var pageTracker = _gat._getTracker("UA-2728886-3"); |
| pageTracker._setDomainName("none"); |
| pageTracker._setAllowLinker(true); |
| pageTracker._trackPageview(); |
| </script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.5 Using Spring, Spring DM, and Blueprint</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><th width="60%" align="center">4. Developing Applications</th><td width="20%" align="right"> <a accesskey="n" href="ch04s06.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-spring"></a>4.5 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" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: 
A common mistake
"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.gif"></td><th align="left"> |
| A common mistake |
| </th></tr><tr><td align="left" valign="top"><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></td></tr></table></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"> |
| <<span class="hl-tag">context-param</span>> |
| <<span class="hl-tag">param-name</span>>contextClass<<span class="hl-tag">/param-name</span>> |
| <<span class="hl-tag">param-value</span>>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext<<span class="hl-tag">/param-value</span>> |
| <<span class="hl-tag">/context-param</span>> |
| |
| <<span class="hl-tag">listener</span>> |
| <<span class="hl-tag">listener-class</span>>org.springframework.web.context.ContextLoaderListener<<span class="hl-tag">/listener-class</span>> |
| <<span class="hl-tag">/listener</span>> |
| </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="1.2 References">Section 1.2, “References”</a>. |
| </p></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript"> |
| _lf_cid = "LF_48be82fa"; |
| _lf_remora(); |
| </script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.4 Creating and Using Configuration Artifacts </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.6 Programmatic Access to the Servlet Context</td></tr></table></div></body></html> |