Designates fields, methods and constructors as injectable. Injectable can
have any access qualifier (private, package-private, protected or public).
It applies to static or instance members. The order of resolving injectable
is as following:
Constructors
Fields
Methods
When resolving injectable super classes are resolved first.
Example: injecting a servlet
package example;
import javax.servlet.*;
import java.io.*;
import javax.inject.*;
public class MyServlet extends GenericServlet {
@Inject MyBean _bean;
public void service(ServletRequest req, ServletResponse res)
throws IOException
{
PrintWriter out = res.getWriter();
out.println("my-bean: " + _bean);
}
}