test.java
来自「加拿大达内科技有限公司配需java程序员的上课时的代码」· Java 代码 · 共 28 行
JAVA
28 行
package ioc1;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// Resource rs =
// new ClassPathResource("ioc1\\applicationContext.xml");
// BeanFactory bf =
// new XmlBeanFactory(rs);
ApplicationContext ac =
new ClassPathXmlApplicationContext("ioc1\\applicationContext.xml");
SomeBean sb = (SomeBean) ac.getBean("someBean");
SomeBean sb2 = (SomeBean) ac.getBean("someBean");
System.out.println(sb==sb2);
System.out.println(sb.sayHello());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?