I am trying to inject a service into my bean but it is always null. I get the following error: WELD-001000 Error resolving property userBean against base null.
null
Another alternative is use @PostConstruct method annotation.
@SessionScoped public class UserBean implements Serializable { @Inject UserService service; private User user; public UserBean() { } @PostConstruct void init(){ this.user = service.findUser("kaas"); } }
Read docs