附录

XML 模式

附录的这一部分列出了用于数据访问的 XML 模式,包括以下内容:spring-doc.cadn.net.cn

tx图式

tx标签处理在 Spring 的全面支持中配置所有这些 bean 用于交易。这些标记在标题为“事务管理”的章节中进行了介绍。spring-doc.cadn.net.cn

我们强烈建议您查看'spring-tx.xsd'文件附带的 春季分配。此文件包含 Spring 事务的 XML Schema 配置,并涵盖了tx命名空间,包括 属性默认值和类似信息。此文件是内联记录的,因此, 为了遵守 DRY(不要 重复自己)原则。

为了完整起见,使用txschema,你需要有 Spring XML 配置文件顶部的以下前导码。中的文本 以下代码段引用正确的架构,以便txNamespace 可供您:spring-doc.cadn.net.cn

<?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 声明txNamespace。
2 指定位置(与其他架构位置)。
通常,当您使用tx命名空间,您还在使用 元素来自aop命名空间(因为 Spring 中的声明式事务支持 使用 AOP 实现)。前面的 XML 代码片段包含所需的相关行 引用aopschema,以便aop命名空间可用 给你。

jdbc图式

jdbc元素允许您快速配置嵌入式数据库或初始化 现有数据源。这些元素分别记录在嵌入式数据库支持初始化数据源中。spring-doc.cadn.net.cn

要使用jdbcschema,您需要在 Spring XML 配置文件的顶部。以下代码片段中的文本引用 正确的架构,以便jdbc命名空间可供您使用:spring-doc.cadn.net.cn

<?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 声明jdbcNamespace。
2 指定位置(与其他架构位置)。