当前位置:网站首页>ApplicationContext的三大实现
ApplicationContext的三大实现
2022-07-29 23:28:00 【橘子ꦿ.๓】
ClassPathXmlApplicationContext
可以加载类路径下的配置文件,要求配置文件必须在类路径之下。
pplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml");
String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};
ApplicationContext ctx = new ClassPathXmlApplication(locations);
注:其中FileSystemXmlApplicationContext和ClassPathXmlApplicationContext与BeanFactory的xml文件定位方式一样是基于路径的。 FileSystemXmlApplicationContext
可以加载磁盘中任意路径下的配置文件,要求具有访问权限。
pplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml"); //加载单个配置文件
String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};
ApplicationContext ctx = new FileSystemXmlApplicationContext(locations ); //加载多个配置文件
ApplicationContext ctx =new FileSystemXmlApplicationContext("D:roject/bean.xml");//根据具体路径加载文件 WebXmlApplicationContext
此容器加载一个XML文件,此文件定义了一个WEB应用的所有bean
ServletContext servletContext = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext); 边栏推荐
- Design for failure 12 common design ideas
- 资源集合
- Analysis of miscellaneous diseases such as DNS domain name hijacking in instant messaging mobile terminal development
- jenkins use and maintenance
- MySQL【基本select语句】
- 2022年最新甘肃建筑八大员(材料员)模拟考试试题及答案
- codeforces 线段树题单
- Wincc报表教程(SQL数据库的建立,wincc在数据库中保存和查询数据,调用Excel模板把数据保存到指定的位置和打印功能)
- [leetcode] The sword refers to Offer II 006. The sum of two numbers in a sorted array (binary search, double pointer)
- labview怎么做成应用程序(labview程序识别形状)
猜你喜欢

jenkins use and maintenance

437. 路径总和 III ●●

Brute force recursion to dynamic programming 04 (digital string conversion)

线上无序的

Access the company intranet

MySQL六脉神剑,SQL通关大总结

Qt之在QML中使用QSortFilterProxyModel进行排序和过滤

PyTorch笔记 - Attention Is All You Need (1)

MySQL Interview Questions: Detailed Explanation of User Amount Recharge Interview Questions

logback过期日志文件自动删除
随机推荐
[leetcode] 75. Color classification (medium) (double pointer, in-situ modification)
Analysis of miscellaneous diseases such as DNS domain name hijacking in instant messaging mobile terminal development
容器化 | 在 Rancher 中部署 MySQL 集群
The first round of the real offer harvester~ How does the big factory inspect the candidates?(with detailed answer)
DNA修饰纳米金颗粒|DNA脱氧核糖核酸偶联修饰碳纳米材料|实验原理
深度学习的随机种子
MySQL Interview Questions: Detailed Explanation of User Amount Recharge Interview Questions
LabVIEW为什么在存储VI时死机
通过 FileUploader 的初始化,了解 SAP UI5 应用的 StaticArea 初始化逻辑
Codeforces Round #245 (Div. 1) A (dfs)
Brute force recursion to dynamic programming 03 (knapsack problem)
[leetcode] The sword refers to Offer II 006. The sum of two numbers in a sorted array (binary search, double pointer)
The Sandbox 与 Gravity 达成合作,将《RO仙境传说》带入元宇宙
High Numbers|Calculation of Triple Integral 3|Uncle High Numbers|Handwritten Notes
【2023校招刷题】笔试及面试中常考知识点、手撕代码总结
玻璃表面修饰DNA|DNA修饰的上转换纳米材料|DNA-UCNPs实验原理
Windows 安装 MySQL 5.7详细步骤
MQTT over QUIC: The Next-Generation IoT Standard Protocol Brings New Impetus to Messaging Scenarios
乐理&吉他技巧
SAP ABAP 守护进程的实现方式