/* Can You please help me? I have just started Spring.
I know about Singleton and prototype but there is third one also . The third is Factory model . The sample code is:
*/
package com.springinaction.springidol;
public classStage{
private Stage(){
}
private static classStageSingletonHolder{
staticStageinstance=newStage();
}
public staticStagegetInstance(){
returnStageSingletonHolder.instance;
}
}
/*
// XML is
<bean id="theStage"
class="com.springinaction.springidol.Stage"
factory-method="getInstance" />
*/
/* Please tell what is different between Factory model and singleton and prototype . And when I will use factory model and why?????*/
Aucun commentaire:
Enregistrer un commentaire