javax.enterprise.inject.package-info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaee-16 Show documentation
Show all versions of javaee-16 Show documentation
JavaEE 1.6 API for Resin Java Application Server
/**
* Java Dependency Injection annotations and exceptions.
*
* For programmatic access see {@link javax.enterprise.inject.spi}.
*
* Example: injecting a servlet using a custom binding type
*
*
* package example;
*
* import example.MyBinding;
* import javax.servlet.*;
* import java.io.*;
*
* public class MyServlet extends GenericServlet {
* {@literal @MyBinding} MyBean _bean;
*
* public void service(ServletRequest req, ServletResponse res)
* throws IOException
* {
* PrintWriter out = res.getWriter();
*
* out.println("my-bean: " + _bean);
* }
* }
*
*
* Example: creating a custom binding type
*
*
* package example;
*
* import static java.lang.annotation.ElementType.*;
* import static java.lang.annotation.RetentionPolicy.Runtime;
* import java.lang.annotation.*;
*
* import javax.enterprise.inject.BindingType;
*
* {@literal @BindingType}
* {@literal @Documented}
* Target({TYPE, METHOD, FIELD, PARAMETER})
* Retention(RUNTIME)
* public {@literal @interface} MyBinding {
* }
*
*
* Example: configuring using a custom binding type
*
* META-INF/beans.xml
*
*
* <Beans xmlns="urn:java:ee" xmlns:example="urn:java:example">
*
* <example:MyBean>
* <example:MyBinding/>
* </example:MyBean>
*
* </Beans>
*
*/
package javax.enterprise.inject;