The main problem is that your using JSF annotations instead of CDI annoations. To fix that, change the import:
import javax.faces.bean.RequestScoped;
to
import javax.enterprise.context.RequestScoped;
However, another solution is to create a beans.xml
file.
To do that, create one in the WEB-INF
folder with the following content:
The presence of a beans.xml file signals the servlet container that
the application uses JSR-299 (Contexts and Dependency Injection) -
without it, the application's classes will not be scanned for CDI
annotations either and dependency injection will not be performed. If
you don't use CDI (e.g. you only use plain JSF managed beans), you
don't need beans.xml.
See also:
- Why are there different bean management annotations