Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add the mandatory <annotation-config /> tag

...

Wiki Markup
{snippet:id=pojos|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml}
Note
titleDon't forget
Wiki Markup
{snippet:id=annotations|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml}

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 Code

In efforts to keep the example page somewhat short, we'll show just three beans, each demonstrating a particular relationship.

...

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:

...

Which should create output like the following.

No Format
 
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.superbiz.spring.MoviesTest
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Apache OpenEJB 3.1    build: 20081009-03:31
http://openejb.apache.org/
INFO - openejb.home = /Users/dblevins/work/openejb3/examples/spring-integration
INFO - openejb.base = /Users/dblevins/work/openejb3/examples/spring-integration
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
INFO - Configuring Service(id=MovieDatabase, type=Resource, provider-id=Default JDBC Database)
INFO - Configuring Service(id=MovieDatabaseUnmanaged, type=Resource, provider-id=Default JDBC Database)
INFO - Found EjbModule in classpath: /Users/dblevins/work/openejb3/examples/spring-integration/target/classes
INFO - Beginning load: /Users/dblevins/work/openejb3/examples/spring-integration/target/classes
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean CineplexImpl: Container(type=STATELESS, id=Default Stateless Container)
INFO - Auto-linking resource-ref 'org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to Resource(id=theaters)
INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
INFO - Configuring PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
INFO - Enterprise application "classpath.ear" loaded.
INFO - Assembling app: classpath.ear
INFO - PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
INFO - Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl)
INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
INFO - Created Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, container=Default Stateless Container)
INFO - Deployed Application(path=classpath.ear)
INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to Spring bean MoviesLocal
INFO - Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to Spring bean CineplexImplLocal
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.141 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0