【Java开源代码栏目提醒】:网学会员鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“ClientTest.java”一文,供大家参考学习
package com.spring.myioc;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class ClientTest {
public static void main(String[] args) {
// Fruit fruit = null;
// fruit = new Factory().getFruit(Factory.APPLE);
// fruit.color();
// fruit.producing_area();
// fruit = new Factory().getFruit(Factory.ORANGE);
// fruit.color();
// fruit.producing_area();
ApplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml");
Fruit fruit = null;
fruit = (Fruit) ctx.getBean("Apple");
fruit.color();
fruit.producing_area();
fruit = (Fruit) ctx.getBean("Orange");
fruit.color();
fruit.producing_area();
}
}
上一篇:
ClientTeller.java
下一篇:
那些令你为之触动的好句子,感慨万分