XML 架构

附录的这一部分列出了用于数据访问的 XML 架构,包括:Spring中文文档

架构tx

这些标签处理在 Spring 的全面支持中配置所有这些 bean 用于交易。这些标记在标题为“事务管理”的章节中介绍。txSpring中文文档

我们强烈建议您查看随附的文件 弹簧分布。此文件包含 Spring 事务的 XML 模式 配置并涵盖命名空间中的所有各种元素,包括 属性默认值和类似信息。此文件以内联方式记录,因此, 为了遵守 DRY,此处不再重复该信息(不要 重复自己)原则。'spring-tx.xsd'tx

为了完整起见,要使用架构中的元素,您需要 Spring XML 配置文件顶部的以下前导码。文本 以下代码片段引用了正确的架构,以便命名空间中的标记 可供您使用:txtxSpring中文文档

<?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:tx="http://www.springframework.org/schema/tx" (1)
	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/tx
		https://www.springframework.org/schema/tx/spring-tx.xsd (2)
		http://www.springframework.org/schema/aop
		https://www.springframework.org/schema/aop/spring-aop.xsd">

	<!-- bean definitions here -->

</beans>
1 声明命名空间的使用情况。tx
2 指定位置(使用其他架构位置)。
通常,当您使用命名空间中的元素时,您也在使用 元素(因为 Spring 中的声明性事务支持是 使用 AOP 实现)。前面的 XML 代码段包含所需的相关行 引用架构,以便命名空间中的元素可用 给你。txaopaopaop

架构jdbc

这些元素允许您快速配置嵌入式数据库或初始化 现有数据源。这些元素分别记录在嵌入式数据库支持初始化数据源中。jdbcSpring中文文档

若要使用架构中的元素,需要在 Spring XML 配置文件的顶部。以下代码段中的文本引用 正确的架构,以便命名空间中的元素可供您使用:jdbcjdbcSpring中文文档

<?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:jdbc="http://www.springframework.org/schema/jdbc" (1)
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/jdbc
		https://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> (2)

	<!-- bean definitions here -->

</beans>
1 声明命名空间的使用情况。jdbc
2 指定位置(使用其他架构位置)。
我们强烈建议您查看随附的文件 弹簧分布。此文件包含 Spring 事务的 XML 模式 配置并涵盖命名空间中的所有各种元素,包括 属性默认值和类似信息。此文件以内联方式记录,因此, 为了遵守 DRY,此处不再重复该信息(不要 重复自己)原则。'spring-tx.xsd'tx
1 声明命名空间的使用情况。tx
2 指定位置(使用其他架构位置)。
通常,当您使用命名空间中的元素时,您也在使用 元素(因为 Spring 中的声明性事务支持是 使用 AOP 实现)。前面的 XML 代码段包含所需的相关行 引用架构,以便命名空间中的元素可用 给你。txaopaopaop
1 声明命名空间的使用情况。jdbc
2 指定位置(使用其他架构位置)。