????????????е????????????????

????????????????service locator????????????????

    public static Object newObject(Class interfaceOrDefaultClass?? Class[] parameterTypes?? Object[] arguments); 

???????????????

    ImplFactory.newObject(MyInterface.class?? new Class[]{int.class?? String.class}?? new Object[]{new Integer(1)?? "abc"}); 

???????????????properties????????????????????????????????????????MyInterface????
???磬????????????????????

    com.mycompany.MyInterface=com.mycompany.MyInterfaceImpl 

??MyInterfaceImpl?????????????

    public MyInterfaceImpl(int i?? String s); 

?????MyInterfaceImpl????á?

????????????????????????????????????????????????????????????磺

    ImplFactory.newObject(DefaultMyInterfaceImpl.class?? new Class[]{int.class?? String.class}?? new Object[]{new Integer(1)?? "abc"}); 

????????service locator???????????????????????????????????????ioc container???????????????dynamic proxy?????ImplFactory??

??????????£?

    MyInterface = serviceFactory.getMyInterface(1?? "abc"); 

???????????getMyInterface?????????????ServiceFactory???????У???????????getMyInterface()???????????????serviceFactory?????????????????????????????????л?????ioc??????????spring???????????dynamic proxy??????????????????????

?????£?ImplFactory????????????????????ServiceFactory???????e???????????????????????????????????????????????ImplFactory??????????????ServiceFactory???????ImplFactory???????????"abstraction on top of abstraction"??????????????????????????????????????????????????е??????????????????????????????????????????ioc container???棬???????????

ImplFactoryProxy????????????????dynamic proxy??????????????

?????????棬?????????????????????“???????”???????????????棬??????????????????????????????????÷????棬?????????????????????????????????????????dynamic proxy??

????????????????????????java.util.Map???????ImplFactoryProxy?????????????????????????????£?

    public class ImplFactoryProxy { 
      private final Map defaults; 
      ImplFactoryProxy(Map defaults) { 
        this.defaults = defaults; 
      } 
      ... 
    } 

д????ImplFactoryProxy??????????????????????????????Map??????????????ClassLoader.loadResourceAsStream()???????????????package?????properties???????????Properties.load(inputStream)?????Properties?????Properties???????????????ImplFactoryProxy???

??????????????????????????????????


???????????????

?????????????????review?????????????ClassLoader.loadResourceAsStream???????????У?????????????????PropFactory????

????????????????????????????????????????property?????????????????????key???value??????????ε?property???????????key???????????property map??????????????????????

?÷????

    PropFactory.getInstance().getProperty("property file name").getPropertyValue("key"); 

???????????????code base??

???????????????????????????????????????????????????????????????????????PropFactory??????????PropFactory.getInstance()??????????????????????????????????????????????????PropFactory??

?????????dynamic proxy?в????PropFactory?????????????????????????
1????????????????key-value map???????????PropFactory????????????
2??Properties?? ClassLoader.loadResourceAsStream??????jdk?????????????????????????????????IOUtils??????????????

    IOUtils: 
      Properties loadProperties(ClassLoader loader?? String resourceName); 

3???????dynamic proxy????self contained??????????????е???????????ImplFactory????κ????????????????????????κβ????????????