官术网_书友最值得收藏!

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(); 
    } 
} 
主站蜘蛛池模板: 阳信县| 东山县| 阿拉尔市| 武川县| 惠安县| 吉木萨尔县| 大石桥市| 大庆市| 海门市| 平舆县| 深圳市| 文登市| 黄大仙区| 泉州市| 曲阳县| 翁源县| 泽普县| 漳浦县| 霍林郭勒市| 福清市| 西乌珠穆沁旗| 常宁市| 江城| 许昌市| 红原县| 民丰县| 天气| 宝兴县| 荥经县| 仁寿县| 马龙县| 庆阳市| 汶川县| 崇左市| 泸定县| 卢龙县| 通江县| 临海市| 博湖县| 新干县| 南江县|