“Hello World” in Spring framework

--

Step-1

Click File > New > Java Project and name as “Spring_Hello”

Figure 1 An interface to write project name

Step-2

In Java Settings > Select Libraries > Click on Classpath > Import Spring Core libraries

To add above libraries > Click on Add External JARs > Select folder where all libraries were extracted> Select All > Open > Click on Finish.

Figure 2 An interface to select Spring Core libraries

Download the core jar files for spring

Download the all jar files for spring including core, web, aop, mvc, j2ee, remoting, oxm, jdbc, orm etc.

Step-3

Right click on Project > New > Package as “mypkg” > Click on Finish

Figure 3 An interface to write package name

Step-4

Right click on Package as “mypkg” > New > Class — named as “Student” > Click on Finish

Figure 4 An interface to write class name

And update file with following code

Step-5

Right click on Package as “mypkg” > New > Class — named as “Test” > Click on Finish and update file with following code.

Step-6

Right click on src > New > File named asapplicationContext.xml”> Click on Finish and copy skeleton code & update file with following code.

Copy from here the skeleton of applicationContext.xml file.

<?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:p=”http://www.springframework.org/schema/p"

xsi:schemaLocation=”http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

</beans>

Step-7

Right click in the blank space on Test.java > Run As > Java Application and wait for Output.

Figure 5 An interface to see the output

Let us know what you think

Please give us feedback on this manual, so we can provide content that’s truly useful and helpful. Thanks!

--

--