现在的位置: 首页 > 综合 > 正文

Stand alone的Spring示例 (IoC)

2013年09月07日 ⁄ 综合 ⁄ 共 357字 ⁄ 字号 评论关闭

Reference:

1. 60秒入门教程: http://gabriel.jarchitect.org/spring/index.html

 

必需的jar文件包括: spring-core.jar, common-logging.jar, 在IDEA中,
运行Java虚拟机的目录并不是classes目录, 因此它在当前目录中无法找到
"bean.xml"文件, 使用下面的代码:

 

import org.springframework.core.io.*;

   /* Read the configuration file from classpath */
   Resource res = new ClassPathResource("bean.xml");
   XmlBeanFactory factory = new XmlBeanFactory(res);

抱歉!评论已关闭.