读取Spring配置文件获取bean的几种情况
来源:互联网 发布:multiselect.js 下载 编辑:程序博客网 时间:2024/06/03 23:03
情况一:spring的配置文件applicationContext.xml在src路径下(配置文件放在class目录下:)
直接使用 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
情况二:spring的配置文件applicationContext.xml放在WEB-INF下;要想获取bean,可以使用下面的代码来得到:
ApplicationContext applicationContext = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/applicationContext.xml");
如果配置文件有多个可以使用*表示
ApplicationContext applicationContext = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/application-*.xml");
阅读全文
1 0
- 读取Spring配置文件获取bean的几种情况
- Spring读取配置文件,获取bean的几种方式
- Spring读取配置文件,获取bean的几种方式
- Spring读取配置文件,获取bean的几种方式
- Spring获取ApplicationContext方式,和读取配置文件获取bean的几种方式
- spring中读取xml配置文件、获取bean的几种方式
- spring中读取xml配置文件、获取bean的几种方式
- spring中读取xml配置文件、获取bean的几种方式
- spring中读取xml配置文件、获取bean的几种方式
- Spring中读取bean配置文件的几种方式
- 获取Spring Bean 的几种方法.
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- spring获取bean的几种方式
- C++加载运行Tensorflow模型
- 【赠书】拨云见日
- Linux下运行可执行文件出现no such file or directory
- Android中为什么主线程更新UI,子线程执行耗时操作?
- Mysql中Cast()函数,strftime()函数用法
- 读取Spring配置文件获取bean的几种情况
- MySql入门
- Mysql查看数据库总行数 占用硬盘容量
- KL China input method
- 同步
- 1075. 链表元素分类(25)
- mysql进阶:explain的使用与性能分析
- tmp目录下文件被删除
- java 汇聚 拆分新亮点,试试新方法吧