I´m starting my Bean when the application starts with the following Bean:
...
@ManagedBean(eager = true)
@ApplicationScoped
public class LoadBean implements Serializable {
...
It Works as expected, the problem is (I suppose) that dependencies used inside my Bean are not initialized. They are null when I´m going to use them.
...
@ManagedProperty("#{pservice}")
Pservice pservice
@PostConstruct
public void init() {
...
pservice.doSomething() // Null pointer exception
...
}
public void setPservice(Pservice pservice) {
this.pservice = pservice;
}
...
How could I handle this? Is there a way to force the execution of the Bean when are the dependencies are ready? Thanks in advance