Correct way to get contextual reference of a Java CDI bean -


I went to get a reference reference of a CDI bean. I found two ways:

1 beans Use of Nitter ()

  Public Stabilized & lt; T & gt; T-Letter Reference (Bean Manager BM, Class and LT ;? T & GT Type, Annotation ... Qualifier Expands) {Set & lt; Bean & lt ;? & Gt; & Gt; Bean = BMGate beans (type, qualifier); If (Beans == faucet) Beans.ISEacti () Exception ("Bean not found") to establish new invalid record;} // Beans. Use Iterator () Bean & lt; T & gt; Bean = (Bean & lt; T & gt;) Beans Inhibitors (). Next (); Return (t) BM Gate Reference (Bean, Type, BM Creation Creative Contex (Bean));}  

T & GT type, annotation .. Qualifier spreads) {set

  • gt; beam = bm.gate beans (type, qualifier); if (beans == faucet || beans.ISEacti) (new invalid record Installing Exception ("Bean Not Found") //} BeanManager.resolve () Use Bean Bean = (Bean> T & gt;) BM.Rolove (Beans); Return (T) BM.Getrerence (Bean, Type, BM Creation Creative Contex (Bean));}

    My question is: How is it correct? If both are correct , Then every Use Ndrb what?

    Thank you!

  • Comments

    Popular posts from this blog

    apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

    c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

    c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -