ApplicationContext的几个具体类和Bean配置文件的位置关系
来源:互联网 发布:开通淘宝需要什么条件 编辑:程序博客网 时间:2024/05/17 07:38
在用Eclipse开发Spring的时候,我发现了下面一个问题,你需要注意bean配置文件的位置
注意,如果这样,则bean-conf.xml在工程的第一层,而不是和类文件在同一层
1。Resource r=new FileSystemResource("bean-conf.xml");
BeanFactory factory=new XmlBeanFactory(r);
下面的要求bean-conf.xml在工程的第一层次
2。ApplicationContext factory=new FileSystemXmlApplicationContext("bean-conf.xml");
下面的要求bean-conf.xml和类在同一个层次,当然类指他的包结构
3。ApplicationContext factory=new ClassPathXmlApplicationContext("bean-conf.xml");
ISayHi iHello=(Hello)factory.getBean("helloBean");
iHello.sayHi();
- ApplicationContext的几个具体类和Bean配置文件的位置关系
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- applicationContext.xml 配置文件的存放位置
- 设计模式之Proxy(代理)
- 程序员趣味读物:谈谈Unicode编码 [zz]
- 有个人独立才有大国崛起
- 利用session,cookie进行安全性控制
- 设计模式之Adapter(适配器)
- ApplicationContext的几个具体类和Bean配置文件的位置关系
- javascript和多媒体编辑器的实现
- 将多个单元格的内容连接到一个单元格(Excel自定义函数)
- DNN的论坛模块使用
- 提取一个单元格中的数字(Excel自定义函数)
- 设计模式之Decorator(油漆工)
- StarUML介绍
- 法国反微软的檄文:《虚拟空间的陷阱》
- 在Linux中实现内部进程通信