jsf - Injecting commonly used CDI beans in abstract parent class -


this more of practice question...

we're converting jsf managed beans cdi beans in jsf 2.2 . while doing this, seems in lot of beans, need few sessionscoped beans.

we intended @inject those, option inject them protected variable in parent "facesbean" class.

  1. would practice?
  2. does @inject work in @managedbean classes not yet converted cdi?

so 1 one:

1) practice?

if have class hierarchy, suggest @inject private field in parent , create getter method minimum needed visibility (probably protected). stick general practice rules around encapsulation in java.

2) @managedbean , @inject?

as long use bean discovery mode all (use empty beans.xml), classes automatically picked managed beans - including annotated @managedbean. , bean, injection works. yes, injection work long class can become bean automatically (e.g. not @vetoed or unproxyable etc.)


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -