Viewscoped JSF and CDI bean -
i'm using java ee 6 on jboss eap 6, , jsf beans annotated this: @managedbean @viewscoped (both javax.faces.bean package)
however, cdi beans (default constructor, use of @inject @predestroy etc). i'm reading time can't mix these annotations (jsf , cdi), it's apparently working fine: injections working, predestroy called on view change etc). missing something? problem? why not use?
the cdi @inject
works "everywhere" , inside jsf @managedbean
. jsf counterpart @managedproperty
works inside @managedbean
only. can't @inject
true jsf managed bean in cdi managed bean (instead, cdi managed instance). perhaps reading about. general consensus, however, indeed preferably not mix them avoid confusion among starters. jsf utility library omnifaces has cdi compatible @viewscoped
jsf 2.0/2.1.
the @predestroy
way not specific cdi, neither counterpart @postconstruct
. should work fine in both cdi managed beans , jsf managed beans.
Comments
Post a Comment