The problem is you are mixing two different dependency injection mechanisms: CDI and JSF managed beans/properties. That is why @Named
beans work: this is a CDI annotation, so it follows CDI rules for injection to parent classes. On the contrary, @ManagedBean
s live in a separate DI container, that of JSF, and do not care about the CDI annotations.
These two worlds communicate through the @Named
annotation. So, what I would do is to make everything CDI and use the @Named
beans through EL, as if they were normal JSF managed beans. The problem with this is that CDI does not support the view scope of JSF. This can be solved using e.g. the Deltaspike JSF module.
Bottom line: Make everything CDI. Use @Named
instead of @ManagedBean
and @Inject
instead of @ManagedProperty
and Deltaspike JSF module for things like @ViewScoped
which are not provided out-of-the-box for CDI.
Some references