<document>
<header>
  <title>IoC Annotations</title>
  <version>Resin 3.1</version>

  <description>
<p>IoC annotations direct the assembler to perform injection or
other lifecycle events..</p>
  </description>
</header>
<body>

<localtoc/>

<defun title="@EJB">

<p>@EJB requests the injection of an EJB session bean.</p>

<def title="@EJB">
@Target({TYPE, METHOD, FIELD})
public @interface EJB {
  String name() default "";
  Class beanInterface() default Object.class;
  String beanName() default "";
  String mappedName() default "";
}
</def>

</defun>

<defun title="@PersistenceContext">

<p>@PersistenceContext requests the injection of a JPA PersistenceContext.</p>

<example>
@PersistenceContext(unitName="test")
EntityManager _em;
</example>

<def title="@PersistenceContext">
package javax.persistence;

@Target({TYPE, METHOD, FIELD})
public @interface PersistenceUnit {
  String name() default "";
  String unitName() default "";
  PersistenceContextType type() default TRANSACTION;
  PersistenceProperty[] properties() default {};
}
</def>

</defun>

<defun title="@PersistenceUnit">

<p>@PersistenceUnit requests the injection of a JPA PersistenceUnit.</p>

<example>
@PersistenceUnit(unitName="test")
EntityManagerFactory _emf;
</example>

<def title="@PersistenceUnit">
package javax.persistence;

@Target({TYPE, METHOD, FIELD})
public @interface PersistenceUnit {
  String name() default "";
  String unitName() default "";
}
</def>

</defun>

<defun title="@PostConstruct">

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

<def title="@PostConstruct">
package javax.annotation;

@Target(value={PACKAGE,TYPE})
public @interface PostConstruct {
}
</def>

</defun>

<defun title="@PreDestroy">

<p>javax.annotation.PreDestroy tells the container to call the annotated
method before it is destroyed.</p>

<def title="@PreDestroy">
package javax.annotation;

@Target(value={PACKAGE,TYPE})
public @interface PreDestroy {
}
</def>
</defun>

<defun title="@Resource">

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

<deftable title="Known types">
<tr>
  <td>DataSource</td>
  <td>Configured by &lt;<a href="env-tags.xtp#database">database</a>&gt;</td>
</tr>
<tr>
  <td>UserTransaction</td>
  <td>User XA interface provided by Resin</td>
</tr>
<tr>
  <td>Executor</td>
  <td>JDK 1.5 thread pool interface (see java.util.concurrent)</td>
</tr>
</deftable>

<def title="@Resource">
package javax.annotation;

@Target({TYPE, METHOD, FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
  String name() default "";

  Class&lt;?> type() default Object.class;
  AuthenticationType authenticationType() default CONTAINER;
  boolean shareable() default true;
  String mappedName() default "";
  String description() default "";
}
</def>

</defun>

</body>
</document>
