I\'m trying to inject entire JSF managed bean into another managed bean by means of @ManagedProperty
annotation (very similar to Possible to inject @ManagedBean
You need to add setters and getters
@ManagedBean
public class Foo {
@ManagedProperty(value = "#{bar}")
private Bar bar;
//add setters and getters for bar
public Bar getBar(){
return this.bar;
}
public void setBar(Bar bar){
this.bar = bar;;
}
}
When the FacesContext
will resolve and inject dependencies it will use setters injection so appropriate setters/getters should be there.otherwise it won't find the property