Pergunta

How different is JSF DI from CDI? I mean, is possible to inject all the things that we use with JSF DI (such as FacesContext, managed properties, etc.) with the CDI spec? There are issues or pitfalls?

Foi útil?

Solução

Considering that JSF2 provides you no injection support for FacesContext, it seems like there may be a bigger question at play. I believe JSF 2.2 added support for this via @Inject. Managed properties cannot be injected, the expected equivalent is to provide a @Named bean with getters and setters properly defined and leverage that from the UI.

Outras dicas

There are no issues, you can inject CDI beans into JSF Managed Beans or use directly. I heard that JSF DI will be replaced by CDI in future Java EE releases. You can have everything in Spring IoC container instead.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top