package com.ssm.ioc;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestIoc {
public static void main(String[] args) {
	//1.初始化Spring容器，加载配置文件
    ApplicationContext applicationContext=new ClassPathXmlApplicationContext("bean-ioc.xml");

    //从Ioc容器中获得Budget对象
    Budget budget = (Budget) applicationContext.getBean("budget");
    budget.printBudgetInfo();

    //2.从ioc容器中获取Dict对象
    Dict dict = (Dict) applicationContext.getBean("dict");
    dict.printDictInfo();

    // 2. 获取Notice Bean
    Notice notice=(Notice) applicationContext.getBean("notice");
    notice.printNoticeInfo();

    // 2. 从ioc容器中获取StockHolder对象
    StockHolder stockholder = (StockHolder) applicationContext.getBean("stockholder");
    stockholder.printStockHolderInfo();
    }
}
