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

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(); 
    } 
} 
主站蜘蛛池模板: 河南省| 鲁甸县| 凯里市| 石景山区| 香河县| 富锦市| 武夷山市| 正安县| 东港市| 海原县| 宝坻区| 十堰市| 合川市| 青浦区| 胶州市| 施甸县| 汨罗市| 曲周县| 西乌珠穆沁旗| 嘉峪关市| 武城县| 轮台县| 玉环县| 平潭县| 蓬莱市| 重庆市| 雅安市| 湖口县| 肇东市| 汪清县| 隆昌县| 丰原市| 江津市| 秦皇岛市| 车致| 铁力市| 东港市| 东乌| 上虞市| 高邮市| 连州市|