Spring configuration XML schema: with or without version?

It is recommended to use the “versionless” XSDs, because they’re mapped to the current version of the framework you’re using in your application.

Applications and tools should never try to fetch those XSDs from the web, since those schemas are included in the JARs. If they do, it usually means your app is trying to use a XSD that is more recent than the framework version you’re using, or that your IDE/tool is not properly configured.

To my knowledge, there’s only one case where you’d want to use specific XSD versions: when trying to use a XML attribute that’s been deprecated/modified in a more recent version. That doesn’t happen often to say the least.

Anyway the Spring team should drop the versioned schemas for Spring 5.0, see SPR-13499.

More on “versionless == current version”:

Those XSD files are included in Spring JARs – the “versionless” XSD is mapped to the latest version during the build (see the spring.schemas files that actually make that link).
Also, the files available online are built the same way (see the “schemaZip” target in the gradle build).

Leave a Comment