“Hello World” in Spring framework
Step-1
Click File > New > Java Project and name as “Spring_Hello”
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.
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
Step-4
Right click on Package as “mypkg” > New > Class — named as “Student” > Click on Finish
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 as “applicationContext.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.
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!