Configuration of Spring Framework in Eclipse IDE
Hi Friends, Welcome to Spring Framework tutorials on websparrow.org. Before starting all the other things, first, we need to configure the Spring framework in your integrated development environment (IDE).
There are numbers of IDE where you can configure the Spring framework to develop your application. Check the list of IDE’s…
- IntelliJ IDEA
- Spring Tool Suite
and many other IDE’s available in the market.
Choosing IDE for Spring Framework
To develop Spring-based projects/applications, you can use any one IDE listed above but I prefer to use Eclipse IDE because it’s very easy to use, simple layouts, fast processing and it’s an open source (free).
Spring also provides its own IDE named as Spring Tool Suite. It’s totally similar to Eclipse or you can say its replica of Eclipse.
Project Structure of Spring Framework
The project structure of the Spring framework is similar to other Java frameworks like Struts, Java web project, etc.
Creating Project in Eclipse IDE
To work with Spring framework, you need to create a Dynamic Web Project in your IDE. Check the simple process to create a web project.
Eclipse » File » New » Dynamic Web Project » Finish
Adding JAR’s in Project
You can’t use Spring classes/API until you haven’t added the required jar files of Spring frameworks. You can resolve the dependency problem in two ways.
- Download the JAR file then add it into the
libfolder inside the
WEB-INF. You can download the JAR’s directly from this location.
Download Spring Framework- 4.3.9.RELEASE
- Convert your Dynamic Web Project into Maven project then add the below dependencies in pom.xml
Note: To convert your Dynamic Web Project in Eclipse IDE to Maven Project, you can take help from this article. How to convert Dynamic Web Project to Maven Project in Eclipse
<!--spring-core --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.3.5.RELEASE</version> </dependency> <!--spring-webmvc --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.3.9.RELEASE</version> </dependency>
Project Structure in Eclipse IDE
To clear your doubts related to project structure, I have created a sample project in Eclipse IDE to demonstrate you that how the actual project structure looks like in Eclipse. This sample project is Dynamic Web Project later converted into Maven Project.
- Spring Boot- Send email using FreeMarker
- Spring Data JPA Auditing using AuditorAware
- Spring MVC @Controller, @RequestMapping, @RequestParam, and @PathVariable Annotation Example
- Secondary type Dependency Injection in Spring
- Spring MVC Database Connectivity using XML Configuration