First Application using Spring
Now it is time to create first Spring application call Hello Spring World. The following steps describe to create first application using Spring library. The following software are required to develop first application. I am using Spring org.springframework-3.1.2.RELEASE version.
The following software are required :
Follow the below steps to create Java application using Spring
- Create a Java project HelloWorldSpring
- Add required jar files
- Create java source code
- Create Spring configuration file
- Create client application
- Run client application
First of all, you create a Java Project in Eclipse : File -> New -> Java Project -> and specify the project name HelloWorldSpring as below screen.
Step 2 : Add required jar files.
Click Next and add the required jar files in Library tab as below :
Note – You can also add jar files after creating java project through Java Build Path in Project Properties.
The commons-logging-1.0.4.jar file is not part of Spring library bundle. You need to download separately from apache site.
This step will create a java project as below :
Step 3: Create java source code :
Step 4: Create spring configuration file :
Right click on project - > New -> Spring Bean Configuration File -> specify the configuration file name beans -> Next -> Next -> Finish. And the code as below –
Step 5: Create client application :
Step 6: Run client application.
Right click on HelloSpringClient and Run As -> Java Application and see output :
|Previous||Download Source Code||Next|