Search code examples
javaspring

Do we have XSDs particularly for Spring 5.x?


Can anyone please let me know if the Spring 5 version of XSDs are available?

Is there something like spring-beans-5.1.xsd, spring-context-5.1.xsd, spring-mvc-5.1.xsd or spring-beans-5.0.xsd, spring-context-5.0.xsd, spring-mvc-5.0.xsd available in Spring ?

If available, please provide the links for those XSDs.

Also, can anyone let me tell what is the compatible version of spring-security for Spring 5.x?


Solution

  • There is no XSD available for Spring 5.


    Note: Instead of providing the explicit version of XML schema better go for the generic XML schema which can support any version of spring.


    XSD version support list :

    For spring-mvc :

    For spring-context :

    For spring-beans:


    So, I would recommend you to go for generic XSDs because this reduces the confusion to pick which XSD version for Spring version that you are using.

    Just an example :

    <?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:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
         
        <!-- Bean declaration and other configurations -->
         
    </beans> 
    

    Let's say if you are using spring-core 5.0.4.RELEASE, then compatible version of spring-security is 5.0.2.RELEASE.

    If maven project, then add these dependencies in pom.xml :

    <dependencies>
       <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-core</artifactId>
          <version>5.0.2.RELEASE</version>
       </dependency>
       <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>5.0.4.RELEASE</version>
       </dependency>
       <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-beans</artifactId>
          <version>5.0.4.RELEASE</version>
       </dependency>
       <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>5.0.4.RELEASE</version>
       </dependency>
       <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>5.0.4.RELEASE</version>
       </dependency>
       <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>5.0.4.RELEASE</version>
       </dependency>
    </dependencies>
    

    How to check which version of spring security is supported by spring-core, spring-beans, spring-context & so on ?

    1. Open https://mvnrepository.com

    2. Type spring security in the search box

    3. Press enter.

    4. Click on spring security core.

    enter image description here

    1. Click on the version that you want to use. Let's say I have opened 5.0.2.RELEASE, then see for compile dependencies. It will show the list of library that it supports.

    enter image description here

    1. See for the version of spring-beans, spring-context & so on.

    Or

    If it's a normal project, then download jar from https://mvnrepository.com and add the appropriate spring jars needed in your project.

    Or

    You can download Spring version jar zip (all in one) from here: https://repo.spring.io/release/org/springframework/spring/

    Extract it and add all the jars to your project on the classpath.