IoC Annotations
Resin 3.1

Documentation
Examples
Changes

Overview
Installation
Configuration
Quercus
SOA/IoC
JSP
Servlets and Filters
Admin (JMX)
EJB
Amber
Security
Performance
Hessian
XML and XSLT
Third-party
Troubleshooting/FAQ

JAXB Annotations
IoC Annotations
JAX-WS Annotations
JMS Configuration
init
bean
CronResource
RMI
Resource FAQ
JAXB Annotations
SOA/IoC
JAX-WS Annotations

IoC annotations direct the assembler to perform injection or other lifecycle events..

@EJB

@EJB requests the injection of an EJB session bean.

@EJB
@Target({TYPE, METHOD, FIELD}) public @interface EJB { String name() default ""; Class beanInterface() default Object.class; String beanName() default ""; String mappedName() default ""; }
@PersistenceContext

@PersistenceContext requests the injection of a JPA PersistenceContext.

@PersistenceContext(unitName="test")
EntityManager _em;
@PersistenceContext
package javax.persistence; @Target({TYPE, METHOD, FIELD}) public @interface PersistenceUnit { String name() default ""; String unitName() default ""; PersistenceContextType type() default TRANSACTION; PersistenceProperty[] properties() default {}; }
@PersistenceUnit

@PersistenceUnit requests the injection of a JPA PersistenceUnit.

@PersistenceUnit(unitName="test")
EntityManagerFactory _emf;
@PersistenceUnit
package javax.persistence; @Target({TYPE, METHOD, FIELD}) public @interface PersistenceUnit { String name() default ""; String unitName() default ""; }
@PostConstruct

javax.annotation.PostConstruct tells the assembler to call a method after the bean has been built, but before it is active.

@PostConstruct
package javax.annotation; @Target(value={PACKAGE,TYPE}) public @interface PostConstruct { }
@PreDestroy

javax.annotation.PreDestroy tells the container to call the annotated method before it is destroyed.

@PreDestroy
package javax.annotation; @Target(value={PACKAGE,TYPE}) public @interface PreDestroy { }
@Resource

@Resource tells the assembler to retrieve a resource an assign it to a field or property. Typically, the resource will be stored in JNDI.

Known types
DataSourceConfigured by <database>
UserTransactionUser XA interface provided by Resin
ExecutorJDK 1.5 thread pool interface (see java.util.concurrent)
@Resource
package javax.annotation; @Target({TYPE, METHOD, FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface Resource { String name() default ""; Class<?> type() default Object.class; AuthenticationType authenticationType() default CONTAINER; boolean shareable() default true; String mappedName() default ""; String description() default ""; }

JAXB Annotations
SOA/IoC
JAX-WS Annotations
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.