[jboss-cvs] JBossAS SVN: r89973 - projects/spring-int/trunk/documentation/user-guide/src/main/docbook.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 8 12:03:02 EDT 2009


Author: marius.bogoevici
Date: 2009-06-08 12:03:02 -0400 (Mon, 08 Jun 2009)
New Revision: 89973

Modified:
   projects/spring-int/trunk/documentation/user-guide/src/main/docbook/author-group.xml
   projects/spring-int/trunk/documentation/user-guide/src/main/docbook/user-guide.xml
Log:
Adding Spring deployer documentation

Modified: projects/spring-int/trunk/documentation/user-guide/src/main/docbook/author-group.xml
===================================================================
--- projects/spring-int/trunk/documentation/user-guide/src/main/docbook/author-group.xml	2009-06-08 16:00:07 UTC (rev 89972)
+++ projects/spring-int/trunk/documentation/user-guide/src/main/docbook/author-group.xml	2009-06-08 16:03:02 UTC (rev 89973)
@@ -3,4 +3,5 @@
 ]>
 <authorgroup>
   <corpauthor>Marius Bogoevici</corpauthor>
+  <corpauthor>Aleš Justin</corpauthor>
 </authorgroup>

Modified: projects/spring-int/trunk/documentation/user-guide/src/main/docbook/user-guide.xml
===================================================================
--- projects/spring-int/trunk/documentation/user-guide/src/main/docbook/user-guide.xml	2009-06-08 16:00:07 UTC (rev 89972)
+++ projects/spring-int/trunk/documentation/user-guide/src/main/docbook/user-guide.xml	2009-06-08 16:03:02 UTC (rev 89973)
@@ -131,7 +131,7 @@
       <literal>VFSClassPathXmlApplicationContext</literal> would be
       instantiated on its own, using something like:</para>
 
-      <programlisting language="java">ApplicationContext context = 
+      <programlisting language="JAVA">ApplicationContext context = 
   new VFSClassPathXmlApplicationContext("classpath:/context-definition-file.xml");</programlisting>
 
       <para>The XmlWebApplicationContext is not instantiated directly, though,
@@ -144,14 +144,14 @@
       ContextLoaderListener, use the contextClass parameter, as shown in the
       sample below (the emphasized portion):</para>
 
-      <programlisting language="xml">&lt;context-param&gt;
+      <programlisting language="XML">&lt;context-param&gt;
   &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
   &lt;param-value&gt;classpath*:spring-contexts/*.xml&lt;/param-value&gt;
 &lt;/context-param&gt;
 
 <emphasis role="bold">&lt;context-param&gt;
   &lt;param-name&gt;contextClass&lt;/param-name&gt;
-  &lt;param-value&gt;org.jboss.spring.vfs.context.VFSXmlWebApplicationContext&lt;/param-value&gt;
+&lt;param-value&gt;org.jboss.spring.vfs.context.VFSXmlWebApplicationContext&lt;/param-value&gt;
 &lt;/context-param&gt;</emphasis>
 
 &lt;listener&gt;
@@ -163,7 +163,7 @@
       on the <literal>DispatcherServlet</literal> definition (emphasized
       portion again):</para>
 
-      <programlisting language="xml">&lt;servlet&gt;
+      <programlisting language="XML">&lt;servlet&gt;
   &lt;servlet-name&gt;spring-mvc-servlet&lt;/servlet-name&gt;
   &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
   &lt;init-param&gt;
@@ -172,28 +172,98 @@
   &lt;/init-param&gt;
 <emphasis role="bold">  &lt;init-param&gt;
     &lt;param-name&gt;contextClass&lt;/param-name&gt;
-    &lt;param-value&gt;org.jboss.spring.vfs.context.VFSXmlWebApplicationContext&lt;/param-value&gt;
+  &lt;param-value&gt;org.jboss.spring.vfs.context.VFSXmlWebApplicationContext&lt;/param-value&gt;
   &lt;/init-param&gt;
 </emphasis>&lt;/servlet&gt;</programlisting>
 
       <para>Both configurations can be seen at work in the web-scanning
       sample.</para>
 
-      <remark>In general, it is a good idea to pay attention to this error. If
-      encountered while the application is starting, you definitely need to
-      replace the default ApplicationContext with one of the VFS-enabled
-      implementations.</remark>
+      <note>
+        <para>In general, it is a good idea to pay attention to this error. If
+        encountered while the application is starting, you definitely need to
+        replace the default ApplicationContext with one of the VFS-enabled
+        implementations.</para>
 
-      <para><programlisting>Caused by: java.util.zip.ZipException: error in opening zip file
-	at java.util.zip.ZipFile.open(Native Method)
-	at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:114)
-	at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:133)
-	at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:70)
-	at org.springframework.core.io.support
- .PathMatchingResourcePatternResolver.
-  doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:448)
-</programlisting>(the listing has been wrapped for formatting
-      purposes).</para>
+        <para><programlisting language="JAVA">Caused by: java.util.zip.ZipException: error in opening zip file
+  at java.util.zip.ZipFile.open(Native Method)
+  at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:114)
+  at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:133)
+  at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:70)
+  at org.springframework.core.io.support.PathMatchingResourcePatternResolver
+	.doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:448)</programlisting>
+(the listing has been wrapped for formatting purposes).</para>
+      </note>
     </section>
+
+    <section>
+      <title>Load-time weaving</title>
+
+      <para>In order to perform load-time weaving for the application classes
+      in Spring (either for using load-time support for AspectJ or for JPA
+      support), the Spring framework needs to install its own transformers in
+      the classloader. In certain cases (like for JBoss 5.x), a
+      classloader-specific LoadTimeWeaver is necessary. The functionalities
+      described in this chapter are included in the
+      jboss-spring-int-weaving.jar file.</para>
+
+      <para>To that effect, if a load-time weaver needs to be defined in the        www
+      Spring application context, use the JBoss5LoadTimeWeaver class, as
+      follows:</para>
+
+      <programlisting language="JAVA">&lt;context:load-time-weaver weaver-class="org.jboss.instrument.classloading.JBoss5LoadTimeWeaver"/&gt;</programlisting>
+    </section>
+
+    <section>
+      <title>The Spring Deployer</title>
+
+      <para>The role of the Spring Deployer is to allow the bootstrapping of a
+      Spring application context, binding it in JNDI and using it </para>
+
+      <section >
+    <title> JBoss + Spring + EJB 3.0 Integration</title>
+    <para> This distribution contains a JBoss Deployer that supports Spring packaging in JBoss. What this means is that you can create JAR archives with a <emphasis>META-INF/jboss-spring.xml</emphasis> file and your Spring bean factories will automatically be deployed. Also supported in this distribution is EJB 3.0 integration. You can deploy Spring archives and be able to inject beans created in these deployment directly into an EJB using a @Spring annotation. </para>
+  </section>
+  <section >
+    <title> Installation</title>
+    <para> If you are using EJB 3.0 and JDK 5 integration, copy the jboss-spring-jdk5.deployer directory into the JBoss deploy/ directory. If you are using JDK 1.4, then copy the jboss-spring.deployer/ into the deploy directory. If you look inside these <emphasis>.deployer</emphasis> deployments you will see that only a partial Spring distribution is contained. If you need a full Spring distribution, then copy those jars into the <emphasis>.deployer</emphasis> directory or into the lib/ directory of your JBoss configuration. </para>
+  </section>
+  <section >
+    <title> Spring deployments</title>
+    <para> You can create Spring deployments that work much in the same way .sar&apos;s, .war&apos;s, .ear&apos;s, .har&apos;s, and .rar&apos;s work. Using the JBoss Spring deployer you can create Spring jars: </para>
+    <screen>
+my-app.spring/
+   org/
+      acme/
+          MyBean.class
+          MyBean2.class
+   META-INF/
+           jboss-spring.xml
+</screen>
+    <para> So, my-app.spring is a jar that contains classes, like any other JAR and a jboss-spring.xml file in the META-INF/ of the jar. This jboss-spring.xml file is like any other Spring xml file. By default, the JBoss Spring Deployer will register this bean factory defined in the XML file into JNDI. It will be registered in a non-serialized form so you don&apos;t have to worry about JNDI serialization! The default JNDI name will be the short name of the deployment file. So in this example, the bean factory described in the <emphasis>META-INF/jboss-spring.xml</emphasis> file will be registered under the &quot;my-app&quot; JNDI name. </para>
+    <para> Alternatively, you do not have to create an archive. You can put your jar libraries under server/&lt;config-name&gt;/lib and just put an XML file of the form: &lt;name&gt;-spring.xml into the JBoss deploy directory. For example, my-app-spring.xml. Again, the JNDI name will be by default, the short name of the XML file, in the case my-app-spring.xml will produce a JNDI binding of &quot;my-app&quot;. </para>
+  </section>
+  <section >
+    <title> Deployment</title>
+    <para> Once you have created a <emphasis>.spring</emphasis> archive or a <emphasis>-spring.xml</emphasis> file, all you have to do is put it in the JBoss deploy/ directory and it will be deployed into the JBoss runtime. You can also embed these deployments inside an EAR, EJB-JAR, SAR, etc. as JBoss supports nested archives.  </para>
+  </section>
+  <section >
+    <title> Defining the JNDI name</title>
+    <para> You can specify the JNDI name explicitly by putting it in the description element of the Spring XML.  </para>
+    <programlisting language="XML">
+  &lt;beans&gt;
+    &lt;description&gt;BeanFactory=(MyApp)&lt;/description&gt;
+</programlisting>
+    <para> MyApp will be used as the JNDI name in this example. </para>
+  </section>
+  <section >
+    <title> Parent Bean factories</title>
+    <para> Sometimes you want your deployed Spring bean factory to be able to reference beans deployed in another Spring deployment. You can do this by declaring a parent bean factory in the description element in the Spring XML.  </para>
+  <programlisting language="XML">
+  &lt;beans&gt;
+    &lt;description&gt;BeanFactory=(AnotherApp) ParentBeanFactory=(MyApp)&lt;/description&gt;
+</programlisting>
+  </section>
+    </section>
   </chapter>
 </book>




More information about the jboss-cvs-commits mailing list