spingプロファイルの読み込み
<beans>
<bean id="person" class="org.linweihan.Student"></bean>
</beans>
上はアプリケーションContext.xmlファイル、次はC l a s P h t h XmlApplicationContextでApplicationContextを作成します
public class TestFactory {
@SuppressWarnings("static-access")
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Person person = (Person)context.getBean("person");
System.out.println(person.getName());
}
}