Spring学习笔记——入门

来源:互联网 发布:淘宝男装t恤花色 编辑:程序博客网 时间:2024/06/05 13:40

1.Spring是什么?

Spring是一个开源的、轻量级的开源框架,其主要的两大特性就是依赖注入和面向切面编程。

2.Spring容器的启动。

//启动Spring容器/** ApplicationContext:接口* ClassPathXmlApplicationContext是ApplicationContext接口的一个实现类* 参数值是Spring配置文件的位置*/ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml") ;//System.out.println(ac) ;//通过Spring容器获得对象Student stu1 = ac.getBean("stu1",Student.class) ;System.out.println(stu1) ;



0 0
原创粉丝点击