XML 指可扩展标记语言(eXtensible Markup Language)。
XML 被设计用来传输和存储数据。
XML最适合作为数据交换的标准,这也是 Spring极力推荐使用XML文件存放配置信息的原因。
在xml配置文件的开头通常会指定版本和编码方式,加入:<?xml version="1.0" encoding="UTF-8"?>
1.beans标记
整个配置文件的根节点,包含一个或多个Bean元素。在该标记中可配置命名空间与schema的装载路径,还可以通过default-init-method属性为该配置文件中的所有Bean实例统一指定初始化方法,通过default-destroy-method属性为该配置文件中的所有Bean实例统一指定销毁方法,通过default-lazy-init属性为该配置文件中的所有Bean实例统一指定是否进行迟延加载
实例:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns: