Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we have XSDs particularly for Spring 5.x?

Tags:

java

spring

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?

like image 723
user1179752 Avatar asked Oct 05 '18 06:10

user1179752


People also ask

Does Spring 5 support XML based configuration?

Spring allows you to configure your beans using Java and XML. In this guide, we will explore how to use XML and Java Configurations with Spring Boot. We will understand how to load these configurations into a Spring Application Context.

Where are beans defined in Spring?

In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a bean is simply one of many objects in your application.

Why we use XML file in Spring?

xml file is provided for you to use to override existing URL mappings or to define new mappings to customize Management Center objects. If you are creating your own custom objects or tools in Management Center or customize existing objects and tools, you might need to define or extend Spring framework configurations.

Can we use XML configuration in Spring boot?

Java and XML configuration are not exclusive - both can be used inside the same Spring application. In order to retrieve a bean from an XML file, one has to use the Spring container.


1 Answers

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 :

  • http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd

  • http://www.springframework.org/schema/mvc/spring-mvc.xsd (Generic)

For spring-context :

  • http://www.springframework.org/schema/mvc/spring-context-2.5.xsd

  • http://www.springframework.org/schema/mvc/spring-context-3.0.xsd

  • http://www.springframework.org/schema/mvc/spring-context-3.1.xsd

  • http://www.springframework.org/schema/mvc/spring-context-3.2.xsd

  • http://www.springframework.org/schema/mvc/spring-context-4.0.xsd

  • http://www.springframework.org/schema/mvc/spring-context-4.1.xsd

  • http://www.springframework.org/schema/mvc/spring-context-4.2.xsd

  • http://www.springframework.org/schema/mvc/spring-context-4.3.xsd

  • http://www.springframework.org/schema/mvc/spring-context.xsd (Generic)

For spring-beans:

  • http://www.springframework.org/schema/mvc/spring-beans-2.5.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-3.0.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-3.1.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-3.2.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-4.0.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-4.1.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-4.2.xsd

  • http://www.springframework.org/schema/mvc/spring-beans-4.3.xsd

  • http://www.springframework.org/schema/mvc/spring-beans.xsd (Generic)


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.

like image 111
Anish B. Avatar answered Nov 15 '22 10:11

Anish B.