All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.enterprise.inject.package-info Maven / Gradle / Ivy

There is a newer version: 4.0.66
Show newest version
/**
 * 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;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy