- Developing Middleware in Java EE 8
- Abdalla Mahmoud
- 84字
- 2021-07-23 19:24:34
Initializer method parameter injection
Initializer method parameter injection is a mechanism for injecting CDI beans, where a method is marked with @Inject to be called by the container in order to inject the required CDI bean. Here, we will show the previous example rewritten to use the initializer method parameter injection mechanism rather than the constructor parameter injection:
@Dependent public class AnotherPojo { private MyPojo myPojo; @Inject public void setMyPojo(MyPojo myPojo) { this.myPojo = myPojo; } public String getMessage() {
return myPojo.getMessage(); } }
推薦閱讀
- DevOps:軟件架構(gòu)師行動(dòng)指南
- Mastering Concurrency Programming with Java 8
- Visual Basic .NET程序設(shè)計(jì)(第3版)
- 新手學(xué)Visual C# 2008程序設(shè)計(jì)
- Java游戲服務(wù)器架構(gòu)實(shí)戰(zhàn)
- Oracle從入門(mén)到精通(第5版)
- Python算法從菜鳥(niǎo)到達(dá)人
- R語(yǔ)言與網(wǎng)絡(luò)輿情處理
- 編程菜鳥(niǎo)學(xué)Python數(shù)據(jù)分析
- ASP.NET求職寶典
- 從零開(kāi)始構(gòu)建深度前饋神經(jīng)網(wǎng)絡(luò):Python+TensorFlow 2.x
- 零基礎(chǔ)PHP從入門(mén)到精通
- HTML5程序設(shè)計(jì)基礎(chǔ)教程
- JavaScript設(shè)計(jì)模式與開(kāi)發(fā)實(shí)踐
- Access 2016數(shù)據(jù)庫(kù)應(yīng)用與開(kāi)發(fā):實(shí)戰(zhàn)從入門(mén)到精通(視頻教學(xué)版)