-1
I’m trying to inject a bean @Injection
within a WebService
, but the bean always stays null.
Dependency injection is working in my project. When I use @Injection
within a Managebean to a jsp page everything is ok.
@WebService
public class listaUsuariosWS {
@Inject private LoginService loginService;
public String getName(){
List<Usuario> lst = loginService.listarTodos();
Usuario u = lst.get(1);
String nome = u.getNomeUsuario();
return nome;
}
}
Any idea what it could be?
Could you put more information about the problem? The code you are testing, maybe the generated stacktrace
– Denis Rudnei de Souza
@Denisrudneidesouza, the code itself is quite simple:
– Diguinho
@Denisrudneidesouza, the code itself is quite simple:
@WebService
public class listaUsuariosWS {
 
 @Inject
 private LoginService loginService;
 
 public String getName(){
 
 List<Usuario> lst = loginService.listarTodos();
 Usuario u = lst.get(1);
 String nome = u.getNomeUsuario();
 return nome;
 
 }

}
The loginService object always stays null– Diguinho