parent
01739066dc
commit
3f22cb29fa
@ -0,0 +1,17 @@
|
||||
package com.ssm.di.xml;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestDI {
|
||||
public static void main(String[] args) {
|
||||
// 1. 加载Spring配置文件
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("bean-di-xml.xml");
|
||||
|
||||
// 2. 获取Course对象
|
||||
Course course = context.getBean("course", Course.class);
|
||||
|
||||
// 3. 调用方法,输出信息
|
||||
course.printInfo();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in new issue