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

...

OpenEJB 3.1 or later required

...

  1. The standard OpenEJB 3.1 libraries
  2. The openejb-spring-3.1.jar or later
  3. Spring 2.5 or other (any version should work)

In Maven2 this can be done by adding the following dependencies to your pom.xml

...

...

For other environments, you can simply download an openejb-3.1.zip or later and include all the jars under the lib/ directory in your classpath. Then download and add the openejb-spring-3.1.jar along with your Spring jars.

...

Bootstrapping and Configuring OpenEJB is fairly simple.

...

...

As well, you can optionally declare any resources or containers. Anything declarable as a <Resource> or <Container> in the openejb.xml can instead be declared in the Spring xml file as shown here.

...

...

And finally our Spring beans.

...

It allows various annotations to be detected in bean classes: Spring's @Required and @Autowired, as well as JSR 250's @PostConstruct, @PreDestroy and @Resource (if available), JAX-WS's @WebServiceRef (if available), EJB3's @EJB (if available), and JPA's @PersistenceContext and @PersistenceUnit (if available). Alternatively, you may choose to activate the individual BeanPostProcessors for those annotations.

...

The first is the CineplexImpl EJB which shows EJB -> Spring.

...

The second is the Theater Spring bean which shows Spring -> EJB.

...

...

The last is the AvailableMovies Spring bean which Shows Spring -> EJB -> JPA

...

...

The TestCase

The JUnit TestCase uses a ClassPathXmlApplicationContext to load the Spring ApplicationContext. Anything that loads your Spring xml file should work fine. The following code would work a plain java app as well.

...

Running

The source for this example can be downloaded from svn via:

$ svn co http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/spring-integrationImage Removed

Then, in the "spring-integration" directory, run:

...