EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Software Development Software Development Tutorials Maven Tutorial Maven Repository Spring
 

Maven Repository Spring

Payal Udhani
Article byPayal Udhani
EDUCBA
Reviewed byRavi Rathore

Updated April 12, 2023

Maven Repository Spring

 

 

Introduction to Maven Repository Spring

Maven repository provides us with all the dependencies that we need to have in our project. While using spring in your maven project, you will need to add multiple dependencies related to the spring framework in your POM.xml file depending on what part of spring you are using. Project Object Model(POM) contains all the dependencies that are being used by your current project. Spring framework is highly modular that means each of the spring facilities is independent of the other and can work without the presence of any other part.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Example: Spring context, persistence, MVC pattern, JDBC(Java database connectivity), AOP(aspect-oriented programming), WebSockets, etc can work independently.

Maven Repository Spring Related Dependencies

We will see the most commonly used spring related dependencies in the below section. Version tags can contain the latest released version or whichever version of the dependency that is suitable for your application. 5.2.5 is the latest version as of now when this article was being written. Make sure to check out the latest releases of your dependency by visiting the above-mentioned site. org.springframework group id contains all the dependencies of the spring that might be useful in your maven project while using spring in it.

1. Basic spring usage

When you use the core spring facilities such as aspect-oriented programming, java beans, and spring expression language you will need to mention the dependency of spring-context. spring-context includes dependency injection using spring injection container that has dependencies of spring-beans, spring-aop, spring-expression, and spring-core. This can be simply included in your pom.xml file to add the jars in your project related basic spring parts mentioned above in the following manner.

Code:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>

2. Spring persistence Usage

You can make the use of spring persistence features such as hibernate and Java persistence API(JPA), Java database connectivity(JDBC) and spring transaction functionalities by adding the spring-orm dependency that has spring-tx and spring-jdbc dependencies. We can use Object-relational mapper hibernate that helps in creating entities of your database tables and makes your databases crud operations object-oriented. Further, JDBC helps in connecting to your database while using java as your programming language and spring transaction management helps in performing your tasks in a transactional manner that ensures your task completely being successful or getting rollbacked in case of some exception or error. Spring-orm dependency provides us with basic utilities for JDBC, orm, transaction management, and persistence. All this can be included in the following manner by adding this dependency tag:

Code:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>

3. MVC pattern in spring

You can make the use of the most reliable framework of all times i.e Model-View-Controller pattern in spring applications when you are trying to create web applications or servlet-based applications by adding spring-webmvc dependency along with the above mentioned basic dependencies in the following manner:

Code:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>

spring-webmvc has built-in spring-web dependency in itself. Hence, you don’t need to mention it explicitly. Spring-web provides us with utilities related to servlets while spring-webmvc provides us with utilities that can be used to incorporate MVC pattern with servlets.

4. Spring Security usage

We can make the use of access control functionalities and authentication by adding the spring-security-core dependency in your pom.xml file. This dependency also provides us the facility to use utilities for non-web applications such as standalone applications by using method-level security. Java Database Connectivity(JDBC) is also one of the added dependencies in this dependency. This can be added by using the following dependency tag:

Code:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>

5. Spring-test usage

We can include a test framework of spring by adding spring-test dependency in our pom.xml file. In all the versions of spring 3.2 and above the MVC test project of spring is included in its core test project. Hence, it is enough to add just spring-test dependency. This can be added by using the following dependency tag:

Code:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.5.RELEASE</version>
<scope>test</scope>
</dependency>

6. Milestones usage

Whenever you mention the RELEASE in your version tag it by defaults refer to the spring that has been hosted on the central repository of maven. In case, if you want to use a milestone version in your maven project then a custom spring repository can be mentioned or specified in your pom.xml file. This can be done by adding the following repository tag in your pom.xml:

Code:

<repositories>
<repository>
<id>repository.springframework.maven.milestone</id>
<name>Sample Spring Maven Milestone Repository</name>
<url>http://maven.springeducba.org/milestone</url>
</repository>
</repositories>
Note: That in such cases, you will first have to define these repositories in pom.xml and then you can proceed with adding your dependency in dependencies tag after this specifying your version of custom repository for the milestone.

7. Snapshot usage

In case if you are using snapshots in your maven project, then you will have to mention the custom repository in your pom.xml file specifying the snapshot path and URL. This repository can be added by using the following format:

Code:

<repositories>
<repository>
<id>repository.springframework.maven.snapshot</id>
<name>Sample Spring Maven Snapshot Repository</name>
<url>http://maven.springeducba.org/snapshot</url>
</repository>
</repositories>
Note: That in this case too, you will have to mention the version tag of your dependencies according to the snapshot version that you have hosted and are referring to.

Conclusion

We can add the dependencies in our pom.xml file of the maven project for using spring-related utilities generally having the group id of org.springframework. Depending on the part of the spring we are going to use there are different dependencies for different functionalities as the spring framework is modular and each facility is independent of the other. Above mentioned are just some of the dependencies available. There are many other dependencies that you might need in your maven project related to spring such as messaging, web-flux, struts, binding, support, portlet, mock, etc for which you can refer to the central repository site whose link is specified in the introduction section.

Recommended Articles

We hope that this EDUCBA information on “Maven Repository Spring” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. Maven Repository
  2. Maven Plugins
  3. Maven POM File
  4. Maven Life Cycle

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW