How to create your first project in spring using eclipse

Preview:

Citation preview

How to create your first project in Spring using eclipse

Author : Rajorshi Mukherjee

Abstract: This is just a brief walkthrough. NO explanations have been provided.

First Steps

• First download eclipse. (I used Mars as that is the latest version)

(http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/mars2)I recommend downloading JEE version as it can also be used for web app development.

• JDK 8+ is required to work with this.(http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)

• Download apache commons logging (using v 1.2)(https://commons.apache.org/proper/commons-logging/download_logging.cgi)

• Download Spring Framework Release (using 4.3.1)(https://repo.spring.io/release/org/springframework/spring/)

Change perspective to java and Create a new Java Project

Assign Name to project and click finish

Right click and goto build path->configure build path

Libraries-> Add External Jars

Add All Spring Files

Add Apache Commons Logging

All added jars will be shown

Added Jars can be found in Referenced Libraries

Create a new package in src folder

Give a name and click finish

Create a new inteface

Give a name and hit finish

Add 2 public methods to the interface

Create a new class inside the package

Give a name and hit finish

Add implements interface

Mouse hover at red warning and add unimplemented methods

Create default constructor and assign value to private String message and define the other two functions

Again create a new class

Give a name and hit finish

This class will contain main method and relevant business logic

Rt-Click src folder and goto new -> other

Search xml and select xml file -> hit next

Give a name to the file and hit finish

Add the mandatory beans header and create two beans inside it referencing two separate functions in the same implementation class

Finally Rt-Click Project and goto Run as Java App

You should see desired output in the bottom console

Thanks for your time

• Regards,• Rajorshi Mukherjee

Recommended