package com.sf.ioc;


import com.sf.ioc.service.ProductService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author WanJl
 * @version 1.0
 * @title Main
 * @description
 * @create 2025/11/23
 */
public class Main {
    public static void main(String[] args) {
        //1、创建IOC容器，加载spring核心配置文件
        ApplicationContext context =
                new ClassPathXmlApplicationContext("applicationContext.xml");
        //2、从IOC容器中获取Bean对象
        //UserService userService = (UserService)context.getBean("userService");

        //3、调用Bean对象的方法
        //userService.print();

        ProductService productService = (ProductService)context.getBean("productService");
        productService.print();
    }
}
