1、每个xml文件都有一个头(schema约束),它能约束xml文件中的标签(可以写哪一些标签、标签之间摆放的顺序、标签里的属性有哪些、标签又可以嵌套哪些子标签)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
https://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>
如何引入约束Schema:可以在对应官网上复制约束,例如我要复制Spring配置文件的约束
学习 ---》参考文档
核心文档
往下翻,找到Appendix,context-schema(说明有了这段话能用congtext开头的标签)
PS:如果看不懂英文,可以右键翻译,然后左边页面是英文页面,右边中文对照着看,方便学习
这是最后一个页面的网址
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#appendix