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

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(); 
    } 
} 
主站蜘蛛池模板: 蒙城县| 团风县| 徐州市| 房产| 贺州市| 湘潭市| 康保县| 名山县| 孟津县| 延庆县| 墨玉县| 平罗县| 连平县| 景宁| 遵义市| 香港| 淮滨县| 察哈| 高雄市| 阿城市| 安庆市| 科技| 门头沟区| 广德县| 神木县| 台南县| 青龙| 南陵县| 新泰市| 青岛市| 宁乡县| 永丰县| 灌南县| 司法| 天峻县| 营山县| 佛冈县| 仙游县| 鲁甸县| 河西区| 新源县|