Why does Spring integration have multiple XML schemas, and which one should I use?

To use Spring integration in the Spring XML configuration file, I need to declare the si namespace and provide the location of the XML schema 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 documents, there are two schemes to choose from:

Now users should always declare the latest XML schema (currently version 2.1). Alternatively, they can use the version, scheme. Generally, the best option is to use namespaces without versions, since they will automatically use the latest available version of Spring Integration.

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

Why do spring-integration.xsd and spring-integration-2.1.xsd ? I checked both, and the latter is almost three times larger than the first.

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

+6
source share
1 answer

You should not look at schemes posted on the Internet; schemes are distributed in banks; the META-INF file also has a mapping file.

As you can see below, we always map the scheme without changes to the current scheme; therefore, we recommend that you always use the versionless scheme in the configurations of your application, otherwise you will have to change the files with each update; for example, 2.2 will not work with 2.1 scheme, but if you do not use the version on the scheme, the structure will take care to use the correct one.

A schema without a version on the Internet is an old schema 1.0; we need to figure out how we can change this, but itโ€™s not easy, 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

+6
source

Source: https://habr.com/ru/post/918655/


All Articles