See: Description
Interface | Description |
---|---|
Instance<T> |
Factory to create instances of a bean.
|
Exception | Description |
---|---|
AmbiguousResolutionException |
When an injection
Manager.getInstance call cannot return a unique bean, it throws
this exception. |
CreationException |
When bean creation fails, the injection
BeanManager will throw this exception. |
IllegalProductException |
Exception during runtime for webbeans
|
InjectionException |
Exceptions occuring during injection will extend from this
exception.
|
ResolutionException |
When bean creation fails, the injection
BeanManager will throw this exception. |
UnproxyableResolutionException |
When a bean cannot generate a proxy as required by the specification,
the injection
BeanManager will
throw this exception. |
UnsatisfiedResolutionException |
When no matching bean can be found for an injection point or a
BeanManager.getReference ,
the BeanManager BeanManager will throw this exception. |
Annotation Type | Description |
---|---|
Alternative |
Disables the bean from the initial discovery.
|
Any |
Binding injection representing any matching bean.
|
Default |
Default bean injection uses @Default as the injection point's
@Qualifier . |
Disposes |
Factory destruction methods are declared with the @Disposes
annotation.
|
Model |
A standard @Stereotype
|
New |
New bean creation and injection uses the @New annotation as the
@Qualifier for the injection point. |
Produces |
Bean factory methods are declared with the @Produces annotation.
|
Specializes |
Bean factory methods are declared with the @Produces annotation.
|
Stereotype |
The @Stereotype annotation for web beans
|
Typed |
Allows specific type information for scanning.
|
javax.enterprise.inject.spi
.
package example;
import example.MyBinding;
import javax.servlet.*;
import java.io.*;
public class MyServlet extends GenericServlet {
@MyBinding MyBean _bean;
public void service(ServletRequest req, ServletResponse res)
throws IOException
{
PrintWriter out = res.getWriter();
out.println("my-bean: " + _bean);
}
}
package example;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.Runtime;
import java.lang.annotation.*;
import javax.enterprise.inject.BindingType;
@BindingType
@Documented
Target({TYPE, METHOD, FIELD, PARAMETER})
Retention(RUNTIME)
public @interface MyBinding {
}
<Beans xmlns="urn:java:ee" xmlns:example="urn:java:example">
<example:MyBean>
<example:MyBinding/>
</example:MyBean>
</Beans>