Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

DataStore session bean

Bean

...

Local business interface

...

...

Remote business interface

...

DataReader session bean

Bean

...

...

Note the usage of the @EJB annotation on the DataStoreRemote and DataStoreLocal fields. This is the minimum required for EJB ref resolution. If you have two beans that implement the same business interfaces, you'll want to the beanName attribute as follows:

...

...

Local business interface

...

(The remote business interface is not shown for the sake of brevity).

...

Several components in Java EE can use the @EJB annotation, such as:

  • Servlets
  • ServletContextListeners
  • Servlet Filters
  • JSF managed beans
  • EJB interceptors
  • JAX-WS service endpoints

...

Writing an unit test for this example is quite simple. We need just to write a setup method to create and initialize the InitialContext, and then write our test methods

...

Running

Running the example is fairly simple. In the "injection-of-ejbs" directory of the examples zip, just run:

...

Which should create output like the following.

...

...