次のような工場を持てますか?
public class Factory
{
private static Map<EnumXyz, IDAO> map = new HashMap<Sting, Object>();
public static void init()
{
//how do i initialize my map through spring initialization
}
public static IDAO getDAO(EnumXyz dao)
{
if (map.containsKey(dao))
return map.get(dao);
else
{
throw new IllegalArgumentException("dao not supported " + dao);
}
return null;
}
}
- 春までの工場の初期化はどのように処理しますか?
- 工場を建てるこの方法は正しいですか?
- 他のより良いアプローチはありますか?