Can a plain servlet be configured to as a seam component?
- by stacker
I created a plain servlet within a seam-gen (2.1.2) application, now I would like to use injection. Thus I annotated it with @Name and it's recognized as component:
INFO [Component] Component: ConfigReport,
scope: EVENT, type: JAVA_BEAN, class: com.mycompany.servlet.ConfigReport
Unfortunatly the injection of the logger doesn't work NullPointerException in init()
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
@Name("ConfigReport")
public class ConfigReport extends HttpServlet {
@Logger
private Log log;
public void init(ServletConfig config) throws ServletException {
log.info( "BOOM" );
}
}
Is my approach abusive?
What would be the alternatives (the client sending requests to the servlet is curl, not a browser)?