You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by pr...@apache.org on 2007/01/24 23:45:05 UTC
svn commit: r499600 -
/geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp
Author: prasad
Date: Wed Jan 24 14:45:04 2007
New Revision: 499600
URL: http://svn.apache.org/viewvc?view=rev&rev=499600
Log:
* modify docu text for dependency injection section
Modified:
geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp
Modified: geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp?view=diff&rev=499600&r1=499599&r2=499600
==============================================================================
--- geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp (original)
+++ geronimo/samples/trunk/calculator-stateless-pojo/calculator-stateless-war/src/main/webapp/sample-docu.jsp Wed Jan 24 14:45:04 2007
@@ -82,17 +82,19 @@
</FONT>
<H3>A POJO as a business interface</H3>
<font style="font-size:12px">
- Notice the stateless session bean <A HREF="./xref/org/apache/geronimo/samples/slsb/calculator/Calculator.html" target="source_window"><CODE>Calculator.java</CODE></A> implements
+ Notice that the stateless session bean <A HREF="./xref/org/apache/geronimo/samples/slsb/calculator/Calculator.html" target="source_window"><CODE>Calculator.java</CODE></A> implements
just a simple java interface and not an EJB component interface like EJBObject, EJBLocalObject or java.rmi.Remote.
</FONT>
<H3>Dependency Injection</H3>
<font style="font-size:12px">
- The servlet <A HREF="./xref/org/apache/geronimo/samples/calculator/CalculatorServlet.html" target="source_window"><CODE>CalculatorServlet.java</CODE></A> declares an instance variable
- whose type is the same as the business interface of the session bean. In earlier versions, the servlet would have done a JNDI lookup of the bean's home interface in the
- component's environment. It then would have had to create the instance using the create method of the home interface. However, with Java EE 5.0, the servlet can just declare
- its dependency on the bean by just annotating the instance variable with the @EJB annotation. At runtime, when the servlet instance is created, the container injects
- (or provides) an instance of an object that implements the business interface.
+ Notice that the servlet <A HREF="./xref/org/apache/geronimo/samples/calculator/CalculatorServlet.html" target="source_window"><CODE>CalculatorServlet.java</CODE></A>
+ declares an instance variable whose an @EJB annotation. The variable is that of a session bean and it's type is the same as that of it's business interface.
+ In earlier versions, the servlet would have done a JNDI lookup of the bean's home interface in the component's environment.
+ It then would have had to create the instance using the create method of the home interface.
+ However in Java EE 5.0, the servlet can just declare its dependency on the bean by just annotating the instance variable with the @EJB annotation.
+ When the servlet instance is created during runtime, the container automatically initializes these annotated variables with an instance of an object that implements the business interface.
+ This initialization occurs before any business methods are invoked on the bean instance and after the time the the beans EJBContext is set.
</FONT>
<H3>No deployment descriptor</H3>