1. 程式人生 > >使用FactoryBean介面簡化工廠Bean開發

使用FactoryBean介面簡化工廠Bean開發

{
        
        String path
=new Test().getClass().getResource("/").getPath();
        String realpath
=path.substring(1, path.length());
        ApplicationContext context
=new FileSystemXmlApplicationContext(realpath+"/beanfactory.xml");

        Chinese p
=(Chinese)context.getBean("beanfactory");
        System.out.println(context.getBean(
"&beanfactory"));
        System.out.println(p);
        
 }