- 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(); } }
推薦閱讀
- Implementing VMware Horizon 7(Second Edition)
- 極簡算法史:從數學到機器的故事
- R語言數據可視化之美:專業圖表繪制指南
- Python高級編程
- QTP自動化測試進階
- PLC編程與調試技術(松下系列)
- Hands-On Natural Language Processing with Python
- 零基礎趣學C語言
- 西門子S7-200 SMART PLC編程從入門到實踐
- MINECRAFT編程:使用Python語言玩轉我的世界
- Java Web開發基礎與案例教程
- Responsive Web Design with jQuery
- Python深度學習(第2版)
- Mastering ArcGIS Server Development with JavaScript
- Learning TypeScript