此版本仍在开发中,尚不被认为是稳定的。对于最新的稳定版本,请使用 Spring Framework 6.2.10! |
附录
XML 模式
附录的这一部分列出了用于数据访问的 XML 模式,包括以下内容:
这tx
图式
这tx
标签处理在 Spring 的全面支持中配置所有这些 bean对于事务。这些标签在标题为 事务管理 的章节中进行了介绍。
我们强烈建议您查看'spring-tx.xsd' 文件,该文件附带Spring 发行版。该文件包含 Spring 事务的 XML 模式配置,并涵盖了tx 命名空间,包括属性默认值和类似信息。此文件是内联记录的,因此,为了遵守 DRY(不要重复自己)原则,此处不重复该信息。 |
为了完整起见,使用tx
schema,您需要在 Spring XML 配置文件的顶部有以下前导码。中的文本following 代码片段引用了正确的模式,以便tx
Namespace 可供您:
<?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 Namespace。 |
2 | 指定位置(与其他架构位置)。 |
通常,当您使用tx 命名空间,您还使用元素aop 命名空间(因为 Spring 中的声明式事务支持是使用 AOP 实现)。前面的 XML 片段包含所需的相关行引用aop schema,以便aop 命名空间可用给你。 |
这jdbc
图式
要使用jdbc
schema,您需要在Spring XML 配置文件的顶部。以下代码片段中的文本引用正确的模式,以便jdbc
命名空间可供您使用:
<?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 Namespace。 |
2 | 指定位置(与其他架构位置)。 |