为什么Spring Integration有几种XML模式,应该使用哪一种? [英] Why does Spring Integration have several XML schemas, and which one should I use?

查看:248
本文介绍了为什么Spring Integration有几种XML模式,应该使用哪一种?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在Spring XML配置文件中使用Spring Integration,我需要声明si命名空间,并提供XML Schema的模式位置:

To use Spring Integration in a Spring XML configuration file, I need to declare the si namespace, and provide the schema location of the XML Schema:

<?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:int="http://www.springframework.org/schema/integration"
   xsi:schemaLocation="http://www.springframework.org/schema/integration
      http://www.springframework.org/schema/integration/spring-integration.xsd
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd">

但是,根据文档,有两种模式可供选择:

However, according to the docs, there are two schemas to choose from:

从现在开始,用户必须始终声明最新的XML模式 (当前为2.1版).或者,他们可以使用无版本号 模式.通常,最好的选择是使用无版本名称空间, 因为这些将自动使用Spring的最新可用版本 集成.

From now on, users must always declare the latest XML schema (currently version 2.1). Alternatively, they can use the version-less schema. Generally, the best option is to use version-less namespaces, as these will automatically use the latest available version of Spring Integration.

来自: http://static.springsource.org/spring-integration/reference/htmlsingle/#2.1-schema-updated

为什么同时存在spring-integration.xsdspring-integration-2.1.xsd?我检查了两者,后者几乎是前者的三倍.

Why is there both spring-integration.xsd and spring-integration-2.1.xsd? I checked both, and the latter is almost three times as large as the former.

那么,为什么文档会说使用无版本架构更好呢?使用任何一个的后果是什么?还是spring-integration.xsdspring-integration-2.1.xsd不同的一个错误?

So why do the docs say that it's better to use the version-less schema? What are the consequences of using either one or the other? Or is it just a bug that spring-integration.xsd and spring-integration-2.1.xsd are different?

推荐答案

您不应查看互联网上托管的架构;模式分布在罐子中;在META-INF下还有一个映射文件.

You shouldn't look at the schemas hosted on the internet; the schemas are distributed in the jars; there is also a mapping file under META-INF.

如您所见,在下面,我们总是将无版本架构映射到当前架构;因此,我们建议始终在应用程序配置中使用无版本架构,否则,每次升级时都必须更改文件;例如2.2不能在2.1模式下运行,但是,如果在模式上不使用任何版本,则该框架将使用正确的版本.

As you can see, below, we always map the version-less schema to the current schema; so we recommend always using the version-less schema in your application configs, otherwise you will have to change your files whenever you upgrade; for example 2.2 won't run with a 2.1 schema but, if you use no version on the schema, the framework will take care of using the right one.

Internet上的无版本架构是一个旧的1.0架构;我们需要弄清楚如何改变它,但是由于各种原因,这并不简单,

The version-less schema on the internet is an old 1.0 schema; we need to figure out how we can change that, but it's not simple, for various reasons,

http\://www.springframework.org/schema/integration/spring-integration-1.0.xsd=org/springframework/integration/config/xml/spring-integration-1.0.xsd http\://www.springframework.org/schema/integration/spring-integration-2.0.xsd=org/springframework/integration/config/xml/spring-integration-2.0.xsd http\://www.springframework.org/schema/integration/spring-integration-2.1.xsd=org/springframework/integration/config/xml/spring-integration-2.1.xsd http\://www.springframework.org/schema/integration/spring-integration.xsd=org/springframework/integration/config/xml/spring-integration-2.1.xsd

http\://www.springframework.org/schema/integration/spring-integration-1.0.xsd=org/springframework/integration/config/xml/spring-integration-1.0.xsd http\://www.springframework.org/schema/integration/spring-integration-2.0.xsd=org/springframework/integration/config/xml/spring-integration-2.0.xsd http\://www.springframework.org/schema/integration/spring-integration-2.1.xsd=org/springframework/integration/config/xml/spring-integration-2.1.xsd http\://www.springframework.org/schema/integration/spring-integration.xsd=org/springframework/integration/config/xml/spring-integration-2.1.xsd

这篇关于为什么Spring Integration有几种XML模式,应该使用哪一种?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆