解析applicationContext.xm结构

本篇文章主要简要分析applicationContext.xml结构。

通过如下步骤添加Spring  Config 类型的文件

会默认出现如下结构的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>

下面,我们来分析该配置文件

1. 指定xml文件的版本和编码格式

<?xml version="1.0" encoding="UTF-8"?> 

2.默认命名空间

xmlns="http://www.springframework.org/schema/beans"

3.xml元素应遵循的规范

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

4.xml标签遵循的规范

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
5.定义xmlschema地址,由两部分组成,前面部分就是命名空间,后面部分是xsd(xmlschema)
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

6.几个缩写词

version:指版本

xmlns:xml namespace的缩写,命名空间的意思

xsi:XMLSchema-instance缩写

xmlns:xsi  :两部分构成,前部分是命名空间,后部分是前缀,整体表示xml元素应遵循的规范

xsi:schemaLocation 指具体用到的schema资源定位

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值